public static void AddPositionalOption <TCommand, TOption>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TOption> > propertySelector, string longName)
     where TCommand : class
 {
     AddOption(commandSettings, propertySelector, null, longName, true, null);
 }
 public static void AddOption <TCommand, TOption>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TOption> > propertySelector, string longName,
     Action <ArgsOptionSettings <TOption> > optionSettings) where TCommand : class
 {
     AddOption(commandSettings, propertySelector, null, longName, false, optionSettings);
 }
 public static void AddOption <TCommand, TOption>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TOption> > propertySelector,
     char shortName, string longName) where TCommand : class
 {
     AddOption(commandSettings, propertySelector, shortName, longName, false, null);
 }
 public static void AddSubcommand <TCommand, TSubcommand>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TSubcommand> > propertySelector, string name)
     where TCommand : class
     where TSubcommand : class
 {
     AddSubcommand(commandSettings, propertySelector, name, null);
 }
 public static void AddPositionalOption <TCommand, TOption>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TOption> > propertySelector,
     Action <ArgsOptionSettings <TOption> > optionSettings)
     where TCommand : class
 {
     AddOption(commandSettings, propertySelector, null, null, true, optionSettings);
 }
 public static void AddSubcommand <TCommand, TSubcommand>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TSubcommand> > propertySelector,
     Action <ArgsCommandSettings <TSubcommand> > subcommandSettings)
     where TCommand : class
     where TSubcommand : class
 {
     AddSubcommand(commandSettings, propertySelector, null, subcommandSettings);
 }
        public static void AddSubcommand <TCommand, TSubcommand>(
            this ArgsCommandSettings <TCommand> commandSettings,
            Expression <Func <TCommand, TSubcommand> > propertySelector,
            string name, Action <ArgsCommandSettings <TSubcommand> > subcommandSettings)
            where TCommand : class
            where TSubcommand : class
        {
            var command = SubcommandInitializer.Initialize(commandSettings,
                                                           propertySelector, name, subcommandSettings);

            commandSettings.SubcommandValidationService.Validate(commandSettings, command);
            commandSettings.Subcommands.Add(command);
        }
        private static void AddOption <TCommand, TOption>(this ArgsCommandSettings <TCommand> commandSettings,
                                                          Expression <Func <TCommand, TOption> > propertySelector, char?shortName, string longName,
                                                          bool isPositional, Action <ArgsOptionSettings <TOption> > optionSettings)
            where TCommand : class
        {
            int?position = null;

            if (isPositional)
            {
                position = commandSettings.Options.GetNextPositionalOptionPosition();
            }

            var commandOption = OptionInitializer.Initialize(propertySelector, shortName, longName,
                                                             position, optionSettings, commandSettings.ArgsMapperSettings.Culture);

            commandSettings.CommandOptionValidationService.Validate(commandSettings, commandOption);
            commandSettings.Options.Add(commandOption);
        }
 public static void AddOption <TCommand, TOption>(
     this ArgsCommandSettings <TCommand> commandSettings,
     Expression <Func <TCommand, TOption> > propertySelector) where TCommand : class
 {
     AddOption(commandSettings, propertySelector, null, null, false, null);
 }