public BaseCommandHandlerParameter Insert(string name, string description) { var parameter = new BaseCommandHandlerParameter(name, description); _parameters.Insert(0, parameter); return(parameter); }
private IEnumerable <BaseCommandHandlerParameter> getUsages() { var commands = new List <BaseCommandHandlerParameter>(); var usage = getUsage(); new UsageParser(usage) .Parse().ToList() .ForEach(y => { var name = y.Name; if (!y.Required) { name = "[" + name + "]"; } if (y.Override) { name = "[[" + name + "]]"; } var cmd = new BaseCommandHandlerParameter( name, y.Description, CommandType.FileCommand); y.Parameters.ToList() .ForEach(p => cmd.Add(p)); commands.Add(cmd); }); return(commands); }
private static void printParameter(BaseCommandHandlerParameter parameter, ref int level) { level++; var name = parameter.Name; if (!parameter.Required) name = "[" + name + "]"; Console.WriteLine("{0}{1} : {2}", "".PadLeft(level, '\t'), name, parameter.Description); foreach (var child in parameter.Parameters) printParameter(child, ref level); level--; }
private void setNameProperties(BaseCommandHandlerParameter parameter, string rawName) { Override = false; Required = true; if (rawName.StartsWith("[[")) { Override = true; return; } if (rawName.StartsWith("[")) { Required = false; } }
private BaseCommandHandlerParameter parse(ref int index) { bool isTerminated; var command = getCommand(ref index); 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)); } return(cmd); }
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; }
public BaseCommandHandlerParameter Insert(string name, string description) { var parameter = new BaseCommandHandlerParameter(name, description); _parameters.Insert(0, parameter); return parameter; }
private IEnumerable<BaseCommandHandlerParameter> getUsages() { var commands = new List<BaseCommandHandlerParameter>(); var usage = getUsage(); new UsageParser(usage) .Parse().ToList() .ForEach(y => { var name = y.Name; if (!y.Required) name = "[" + name + "]"; if (y.Override) name = "[[" + name + "]]"; var cmd = new BaseCommandHandlerParameter( name, y.Description, CommandType.FileCommand); y.Parameters.ToList() .ForEach(p => cmd.Add(p)); commands.Add(cmd); }); return commands; }
public BaseCommandHandlerParameter Add(string name, string description) { var parameter = new BaseCommandHandlerParameter(name, description); _parameters.Add(parameter); return parameter; }
public BaseCommandHandlerParameter Add(BaseCommandHandlerParameter parameter) { _parameters.Add(parameter); return parameter; }
protected override void usageAppender(BaseCommandHandlerParameter query) { query.Add("[LIMIT]", "Maximum records to return"); }
private void setNameProperties(BaseCommandHandlerParameter parameter, string rawName) { Override = false; Required = true; if (rawName.StartsWith("[[")) { Override = true; return; } if (rawName.StartsWith("[")) Required = false; }
private IEnumerable<string> getPaths(BaseCommandHandlerParameter x, string path) { if (x.Parameters.Count() == 0) return new string[] { path }; var paths = new List<string>(); x.Parameters.ToList() .ForEach(y => paths.AddRange(getPaths(y, path + "/" + y.Name))); return paths; }
protected virtual void usageAppender(BaseCommandHandlerParameter query) { }
protected override void usageAppender(BaseCommandHandlerParameter query) { query.Rebrand("HINT", "Token path hint file/directory"); }
private void add(DefinitionCache cache, DefinitionCacheItem item, BaseCommandHandlerParameter parameter) { var name = parameter.Name; var child = item.Append( item.Type, item.Location, item.Updated, parameter.Override, parameter.Required, name, parameter.Description); foreach (var cmd in parameter.Parameters) add(cache, child, cmd); }
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; }
private void overrideCommand(DefinitionCache cache, DefinitionCacheItem item, BaseCommandHandlerParameter parameter) { var command = cache.Add( item.Type, item.Location, item.Updated, parameter.Override, parameter.Required, parameter.Name, parameter.Description); foreach (var cmd in parameter.Parameters) add(cache, command, cmd); }
public BaseCommandHandlerParameter Add(BaseCommandHandlerParameter parameter) { _parameters.Add(parameter); return(parameter); }