Ejemplo n.º 1
0
 private bool IsCommand(string arg, IEnumerable <CommandItem> commands, out CommandItem commandFound)
 {
     commandFound = null;
     foreach (var command in commands)
     {
         if (arg.ToLower() == command.Name.ToLower())
         {
             commandFound = command;
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 2
0
 public void Generate(CommandItem command, TextWriter output, string liquidTemplateText)
 {
     try
     {
         var template        = Template.Parse(liquidTemplateText);
         var applicationDrop = ToDrop(_application);
         var commandDrop     = ToDrop(command);
         var result          = template.Render(Hash.FromAnonymousObject(new { application = applicationDrop, command = commandDrop }));
         result = result.Replace(Environment.NewLine, "").Replace(NewLine, Environment.NewLine);
         output.Write(result);
     }
     catch (DotLiquid.Exceptions.SyntaxException exception)
     {
         console.Out.WriteLine($"Syntax error in template [{liquidTemplateText}]: {exception.Message}");
     }
     catch (Exception exception)
     {
         console.Out.WriteLine(exception.ToString());
     }
 }
Ejemplo n.º 3
0
 private ILiquidizable ToDrop(CommandItem command)
 {
     return(new CommandDrop(command));
 }
Ejemplo n.º 4
0
 public CommandDrop(string fullCommand, CommandItem x)
 {
     this.fullCommand = fullCommand;
     this.x           = x;
 }
Ejemplo n.º 5
0
 public CommandDrop(CommandItem x)
 {
     this.fullCommand = x.Name;
     this.x           = x;
 }
Ejemplo n.º 6
0
 internal void AddCommand(CommandItem result)
 {
     _commands.Add(result);
 }