Example #1
0
        private static Command ConfigureCommandLine(Command rootCommand)
        {
            // Add subcommands
            foreach (var subcommand in Subcommands)
            {
                rootCommand.AddCommand(subcommand);
            }

            // Workload command is behind a feature flag during development
            if (Env.GetEnvironmentVariableAsBool("DEVENABLEWORKLOADCOMMAND", defaultValue: false))
            {
                rootCommand.AddCommand(WorkloadCommandParser.GetCommand());
            }

            //Add internal commands
            rootCommand.AddCommand(InstallSuccessCommand);

            // Add options
            rootCommand.AddOption(DiagOption);
            rootCommand.AddOption(VersionOption);
            rootCommand.AddOption(InfoOption);
            rootCommand.AddOption(ListSdksOption);
            rootCommand.AddOption(ListRuntimesOption);

            // Add argument
            rootCommand.AddArgument(DotnetSubCommand);

            return(rootCommand);
        }
Example #2
0
File: Parser.cs Project: agocke/sdk
        private static Command ConfigureCommandLine(Command rootCommand)
        {
            // Add subcommands
            foreach (var subcommand in Subcommands)
            {
                rootCommand.AddCommand(subcommand);
            }

            rootCommand.AddCommand(WorkloadCommandParser.GetCommand());

            //Add internal commands
            rootCommand.AddCommand(InstallSuccessCommand);

            // Add options
            rootCommand.AddOption(DiagOption);
            rootCommand.AddOption(VersionOption);
            rootCommand.AddOption(InfoOption);
            rootCommand.AddOption(ListSdksOption);
            rootCommand.AddOption(ListRuntimesOption);

            // Add argument
            rootCommand.AddArgument(DotnetSubCommand);

            return(rootCommand);
        }
 private static bool IsRunningWorkloadCommand(ParseResult parseResult) =>
 parseResult.RootSubCommandResult() == (WorkloadCommandParser.GetCommand().Name);