コード例 #1
0
        public CommandsWithHelp(IConsumer <string> output, params ICliCommand[] commands)
        {
            var all = commands.Append(this).OrderBy(x => x.Name).ToArray();

            _fullHelpText = $"Commands: {Environment.NewLine}" + string.Join(Environment.NewLine, all.Select(x => new CliCommandHelpText(x)));
            _inner        = new CliCommands(all);
            _output       = output;
        }
コード例 #2
0
    public CommandsWithHelp(string appName, string exeName, ILog log, params ICliCommand[] commands)
    {
        _appName = appName;
        _log     = log;
        var all = commands.Append(this).ToArray();

        _fullHelpText = $"Usage: {Environment.NewLine}" + string.Join($"{Environment.NewLine}", all.Select(x => $"  {exeName} {x.Info}"));
        _inner        = new CliCommands(all);
    }
コード例 #3
0
 public static void Execute(this ICliCommands commands, string[] args) => commands.Execute(args[0], args.Skip(1).ToArray());