public static CommandNameFor ( |
||
type | ||
Résultat | string |
public UsageGraph(Type commandType) { _commandType = commandType; _inputType = commandType.FindInterfaceThatCloses(typeof(IFubuCommand <>)).GetGenericArguments().First(); _commandName = CommandFactory.CommandNameFor(commandType); _commandType.ForAttribute <CommandDescriptionAttribute>(att => { _description = att.Description; }); if (_description == null) { _description = _commandType.Name; } _handlers = InputParser.GetHandlers(_inputType); _commandType.ForAttribute <UsageAttribute>(att => { _usages.Add(buildUsage(att)); }); if (!_usages.Any()) { var usage = new CommandUsage() { CommandName = _commandName, UsageKey = "default", Description = _description, Arguments = _handlers.OfType <Argument>(), ValidFlags = _handlers.Where(x => !(x is Argument)) }; _usages.Add(usage); } }
public UsageGraph(Type commandType) { _commandType = commandType; _inputType = commandType.FindInterfaceThatCloses(typeof(IFubuCommand <>)).GetGenericArguments().First(); _commandName = CommandFactory.CommandNameFor(commandType); _commandType.ForAttribute <CommandDescriptionAttribute>(att => { _description = att.Description; }); if (_description == null) { _description = _commandType.Name; } _handlers = InputParser.GetHandlers(_inputType); _validUsages = new Lazy <IEnumerable <CommandUsage> >(() => { if (_usages.Any()) { return(_usages); } var usage = new CommandUsage() { Description = _description, Arguments = _handlers.OfType <Argument>(), ValidFlags = _handlers.Where(x => !(x is Argument)) }; return(new CommandUsage[] { usage }); }); }
private void listAllCommands(HelpInput input) { var report = new TwoColumnReport("Available commands:"); input.CommandTypes.OrderBy(CommandFactory.CommandNameFor).Each(type => { report.Add(CommandFactory.CommandNameFor(type), CommandFactory.DescriptionFor(type)); }); report.Write(); }