Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Make category inherit Drop (so it can be used in templates) #165

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/Pretzel.Logic/Templating/Context/Category.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using System.Collections.Generic;
using DotLiquid;

namespace Pretzel.Logic.Templating.Context
{
public class Category
public class Category : Drop
{
public IEnumerable<Page> Posts { get; set; }
public string Name { get; set; }
Expand Down
10 changes: 6 additions & 4 deletions src/Pretzel/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ static void Main(string[] args)

var debug = false;
var help = false;
var nopause = false;
var defaultSet = new OptionSet
{
{"help", "Display help mode", p => help = true},
{"debug", "Enable debugging", p => debug = true}
{"debug", "Enable debugging", p => debug = true},
{"nopause", "Don't show \"Press any key to continue...\" message after execution", p => nopause = true}
};
defaultSet.Parse(args);

Expand All @@ -44,15 +46,15 @@ static void Main(string[] args)
return;
}

program.Run(args, defaultSet);
program.Run(args, defaultSet, nopause);
}

private void ShowHelp(OptionSet defaultSet)
{
Commands.WriteHelp(defaultSet);
}

private void Run(string[] args, OptionSet defaultSet)
private void Run(string[] args, OptionSet defaultSet, bool nopause)
{
var commandName = args[0];
var commandArgs = args.Skip(1).ToArray();
Expand All @@ -65,7 +67,7 @@ private void Run(string[] args, OptionSet defaultSet)
}

Commands[commandName].Execute(commandArgs);
WaitForClose();
if (!nopause) WaitForClose();
}

[Conditional("DEBUG")]
Expand Down