Пример #1
0
        private static AddInstallerCommand BuildAddInstallerCommand(FluentCommandLineParser parser, string[] args)
        {
            var command = new AddInstallerCommand();

            parser
            .Setup <string>('i', "installer")
            .Callback(x => command.Installer = x)
            .Required();

            parser
            .Setup <string>('a', "application")
            .Callback(x => command.Application = x)
            .SetDefault(Environment.CurrentDirectory);

            parser
            .Setup <string>('n', "name")
            .Callback(x => command.Name = x);

            parser
            .Setup <string>('e', "environment")
            .Callback(x => command.Environment = x)
            .SetDefault("local");

            parser
            .Setup <string>('h', "hosts")
            .Callback(x => command.Hosts = x.Split(',').Where(y => !string.IsNullOrWhiteSpace(y)).ToList());

            parser.Parse(args);

            return(command);
        }
Пример #2
0
        private static AddInstallerCommand BuildAddInstallerCommand(FluentCommandLineParser parser, string[] args)
        {
            var command = new AddInstallerCommand();

            parser
                .Setup<string>('i', "installer")
                .Callback(x => command.Installer = x)
                .Required();

            parser
                .Setup<string>('a', "application")
                .Callback(x => command.Application = x)
                .SetDefault(Environment.CurrentDirectory);

            parser
                .Setup<string>('n', "name")
                .Callback(x => command.Name = x);

            parser
                .Setup<string>('e', "environment")
                .Callback(x => command.Environment = x)
                .SetDefault("local");

            parser
                .Setup<string>('h', "hosts")
                .Callback(x => command.Hosts = x.Split(',').Where(y => !string.IsNullOrWhiteSpace(y)).ToList());

            parser.Parse(args);

            return command;
        }