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); }
public static void AddWorkloadCommandNuGetRestoreActionConfigOptions(this Command command, bool Hide = false) { command.AddOption(Hide ? HiddenDisableParallelOption : DisableParallelOption); command.AddOption(Hide ? HiddenIgnoreFailedSourcesOption : IgnoreFailedSourcesOption); command.AddOption(Hide ? HiddenNoCacheOption : NoCacheOption); command.AddOption(Hide ? HiddenInteractiveRestoreOption : InteractiveRestoreOption); }
public static void AddWorkloadCommandNuGetRestoreActionConfigOptions(this Command command) { command.AddOption(DisableParallelOption); command.AddOption(IgnoreFailedSourcesOption); command.AddOption(NoCacheOption); command.AddOption(InteractiveRestoreOption); }
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 Command ConfigureCommandLine(Command rootCommand) { // Add subcommands foreach (var subcommand in Subcommands) { rootCommand.AddCommand(subcommand); } // Add options rootCommand.AddOption(DiagOption); rootCommand.AddOption(VersionOption); rootCommand.AddOption(InfoOption); rootCommand.AddOption(ListSdksOption); rootCommand.AddOption(ListRuntimesOption); // Add argument rootCommand.AddArgument(DotnetSubCommand); return(rootCommand); }
public static void AddOptions(this System.CommandLine.Command command, Type commandOptionsType) { var propertyInfos = commandOptionsType.GetProperties(DeclaredOnly); foreach (var propertyInfo in propertyInfos) { var optionAttribute = propertyInfo.GetCustomAttribute <OptionAttribute>(); if (optionAttribute == null) { continue; } var option = new Option(optionAttribute.Aliases, optionAttribute.Description) { IsRequired = optionAttribute.IsRequired, Argument = new Argument { ArgumentType = propertyInfo.PropertyType } }; command.AddOption(option); } }