Beispiel #1
0
 private IEnumerable<BaseCommandHandlerParameter> getUsages()
 {
     var commands = new List<BaseCommandHandlerParameter>();
     var usage = getUsage();
     usage = stripDescription(usage);
     new UsageParser(usage)
         .Parse().ToList()
             .ForEach(y =>
                 {
                     var cmd = new BaseCommandHandlerParameter(
                         y.Name,
                         y.Description,
                         CommandType.FileCommand);
                     y.Parameters.ToList()
                         .ForEach(p => cmd.Add(p));
                     if (!y.Required)
                         cmd.IsOptional();
                     commands.Add(cmd);
                 });
     return commands;
 }
Beispiel #2
0
 private BaseCommandHandlerParameter parse(ref int index)
 {
     bool isTerminated;
     bool isRequired;
     var command = getCommand(ref index, out isRequired);
     if (command == null)
         return null;;
     var description = getDescription(ref index, out isTerminated);
     var cmd = new BaseCommandHandlerParameter(command, description);
     if (!isTerminated)
         getSubCommands(ref index).ForEach(x => cmd.Add(x));
     if (!isRequired)
         cmd.IsOptional();
     return cmd;
 }