internal static void Register(CommandLineApplication app,
                                      Func <ILogger> getLogger)
        {
            app.Command("list", ListCmd =>
            {
                ListCmd.Command("source", SourceCmd =>
                {
                    CommandOption format = SourceCmd.Option(
                        "--format",
                        Strings.SourcesCommandFormatDescription,
                        CommandOptionType.SingleValue);
                    CommandOption configfile = SourceCmd.Option(
                        "--configfile",
                        Strings.Option_ConfigFile,
                        CommandOptionType.SingleValue);
                    SourceCmd.HelpOption("-h|--help");
                    SourceCmd.Description = Strings.ListSourceCommandDescription;
                    SourceCmd.OnExecute(() =>
                    {
                        var args = new ListSourceArgs()
                        {
                            Format     = format.Value(),
                            Configfile = configfile.Value(),
                        };

                        ListSourceRunner.Run(args, getLogger);
                        return(0);
                    });
                });
                ListCmd.Command("client-cert", ClientCertCmd =>
                {
                    CommandOption configfile = ClientCertCmd.Option(
                        "--configfile",
                        Strings.Option_ConfigFile,
                        CommandOptionType.SingleValue);
                    ClientCertCmd.HelpOption("-h|--help");
                    ClientCertCmd.Description = Strings.ListClientCertCommandDescription;
                    ClientCertCmd.OnExecute(() =>
                    {
                        var args = new ListClientCertArgs()
                        {
                            Configfile = configfile.Value(),
                        };

                        ListClientCertRunner.Run(args, getLogger);
                        return(0);
                    });
                });
                ListCmd.HelpOption("-h|--help");
                ListCmd.Description = Strings.List_Description;
                ListCmd.OnExecute(() =>
                {
                    app.ShowHelp("list");
                    return(0);
                });
            });
        }
Beispiel #2
0
        private void ExecuteListCommandRunner()
        {
            ValidateNotExpectedOptions(new Dictionary <string, string>
            {
                { nameof(Path), Path },
                { nameof(FindBy), FindBy },
                { nameof(FindValue), FindValue },
                { nameof(PackageSource), PackageSource },
                { nameof(Password), Password },
                { nameof(StoreLocation), StoreLocation },
                { nameof(StoreName), StoreName }
            });

            var args = new ListClientCertArgs {
                Configfile = ConfigFile
            };

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