internal static void Register(CommandLineApplication app,
                                      Func <ILogger> getLogger)
        {
            app.Command("remove", RemoveCmd =>
            {
                RemoveCmd.Command("source", SourceCmd =>
                {
                    CommandArgument name = SourceCmd.Argument(
                        "name", Strings.SourcesCommandNameDescription);
                    CommandOption configfile = SourceCmd.Option(
                        "--configfile",
                        Strings.Option_ConfigFile,
                        CommandOptionType.SingleValue);
                    SourceCmd.HelpOption("-h|--help");
                    SourceCmd.Description = Strings.RemoveSourceCommandDescription;
                    SourceCmd.OnExecute(() =>
                    {
                        var args = new RemoveSourceArgs()
                        {
                            Name       = name.Value,
                            Configfile = configfile.Value(),
                        };

                        RemoveSourceRunner.Run(args, getLogger);
                        return(0);
                    });
                });
                RemoveCmd.Command("client-cert", ClientCertCmd =>
                {
                    CommandOption packagesource = ClientCertCmd.Option(
                        "-s|--package-source",
                        Strings.Option_PackageSource,
                        CommandOptionType.SingleValue);
                    CommandOption configfile = ClientCertCmd.Option(
                        "--configfile",
                        Strings.Option_ConfigFile,
                        CommandOptionType.SingleValue);
                    ClientCertCmd.HelpOption("-h|--help");
                    ClientCertCmd.Description = Strings.RemoveClientCertCommandDescription;
                    ClientCertCmd.OnExecute(() =>
                    {
                        var args = new RemoveClientCertArgs()
                        {
                            PackageSource = packagesource.Value(),
                            Configfile    = configfile.Value(),
                        };

                        RemoveClientCertRunner.Run(args, getLogger);
                        return(0);
                    });
                });
                RemoveCmd.HelpOption("-h|--help");
                RemoveCmd.Description = Strings.Remove_Description;
                RemoveCmd.OnExecute(() =>
                {
                    app.ShowHelp("remove");
                    return(0);
                });
            });
        }
Exemple #2
0
        private void ExecuteRemoveCommandRunner()
        {
            ValidateNotExpectedOptions(new Dictionary <string, string>
            {
                { nameof(Path), Path },
                { nameof(FindBy), FindBy },
                { nameof(FindValue), FindValue },
                { nameof(Password), Password },
                { nameof(StoreLocation), StoreLocation },
                { nameof(StoreName), StoreName }
            });

            var args = new RemoveClientCertArgs
            {
                Configfile    = ConfigFile,
                PackageSource = PackageSource
            };

            RemoveClientCertRunner.Run(args, () => Console);
        }