Example #1
0
        public static Command GetCommand()
        {
            var command = new Command("test", LocalizableStrings.AppFullName);

            command.AddArgument(SlnOrProjectArgument);

            BlameCrashDumpArgument.SetDefaultValue("full");
            BlameCrashDumpOption.Argument = BlameCrashDumpArgument;

            BlameHangDumpArgument.SetDefaultValue("full");
            BlameHangDumpOption.Argument = BlameHangDumpArgument;

            command.AddOption(SettingsOption);
            command.AddOption(ListTestsOption);
            command.AddOption(EnvOption);
            command.AddOption(FilterOption);
            command.AddOption(AdapterOption);
            command.AddOption(LoggerOption);
            command.AddOption(OutputOption);
            command.AddOption(DiagOption);
            command.AddOption(NoBuildOption);
            command.AddOption(ResultsOption);
            command.AddOption(CollectOption);
            command.AddOption(BlameOption);
            command.AddOption(BlameCrashOption);
            command.AddOption(BlameCrashDumpOption);
            command.AddOption(BlameCrashAlwaysOption);
            command.AddOption(BlameHangOption);
            command.AddOption(BlameHangDumpOption);
            command.AddOption(BlameHangTimeoutOption);
            command.AddOption(NoLogoOption);
            command.AddOption(CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription));
            command.AddOption(CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription));
            command.AddOption(CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription, withShortOption: false));
            command.AddOption(NoRestoreOption);
            command.AddOption(CommonOptions.InteractiveMsBuildForwardOption());
            command.AddOption(CommonOptions.VerbosityOption());

            return(command);
        }
Example #2
0
 public static Command Publish() =>
 CreateWithRestoreOptions.Command(
     "publish",
     LocalizableStrings.AppDescription,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.ProjectArgumentName,
           description: CommonLocalizableStrings.ProjectArgumentDescription),
     CommonOptions.HelpOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.OutputOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.OutputOption)
         .ForwardAsSingle(o => $"-property:PublishDir={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
     CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
     CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
     CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "--manifest",
         LocalizableStrings.ManifestOptionDescription,
         Accept.OneOrMoreArguments()
         .With(name: LocalizableStrings.ManifestOption)
         .ForwardAsSingle(o => $"-property:TargetManifestFiles={string.Join("%3B", o.Arguments.Select(CommandDirectoryContext.GetFullPath))}")),
     Create.Option(
         "--no-build",
         LocalizableStrings.NoBuildOptionDescription,
         Accept.NoArguments().ForwardAs("-property:NoBuild=true")),
     Create.Option(
         "--self-contained",
         LocalizableStrings.SelfContainedOptionDescription,
         Accept.ZeroOrOneArgument()
         .WithSuggestionsFrom("true", "false")
         .ForwardAsSingle(o =>
 {
     string value = o.Arguments.Any() ? o.Arguments.Single() : "true";
     return($"-property:SelfContained={value}");
 })),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
Example #3
0
 public static Command Pack() =>
 CreateWithRestoreOptions.Command(
     "pack",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.SolutionOrProjectArgumentName,
           description: CommonLocalizableStrings.SolutionOrProjectArgumentDescription),
     CommonOptions.HelpOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.CmdOutputDirDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.CmdOutputDir)
         .ForwardAsSingle(o => $"-property:PackageOutputPath={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
     Create.Option(
         "--no-build",
         LocalizableStrings.CmdNoBuildOptionDescription,
         Accept.NoArguments().ForwardAs("-property:NoBuild=true")),
     Create.Option(
         "--include-symbols",
         LocalizableStrings.CmdIncludeSymbolsDescription,
         Accept.NoArguments().ForwardAs("-property:IncludeSymbols=true")),
     Create.Option(
         "--include-source",
         LocalizableStrings.CmdIncludeSourceDescription,
         Accept.NoArguments().ForwardAs("-property:IncludeSource=true")),
     CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "-s|--serviceable",
         LocalizableStrings.CmdServiceableDescription,
         Accept.NoArguments().ForwardAs("-property:Serviceable=true")),
     Create.Option(
         "--nologo|/nologo",
         LocalizableStrings.CmdNoLogo,
         Accept.NoArguments()
         .ForwardAs("-nologo")),
     CommonOptions.InteractiveMsBuildForwardOption(),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
 public static Command ToolInstall()
 {
     return(Create.Command("install",
                           LocalizableStrings.CommandDescription,
                           Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageId)
                           .With(name: LocalizableStrings.PackageIdArgumentName,
                                 description: LocalizableStrings.PackageIdArgumentDescription),
                           Create.Option(
                               "-g|--global",
                               LocalizableStrings.GlobalOptionDescription,
                               Accept.NoArguments()),
                           Create.Option(
                               "--tool-path",
                               LocalizableStrings.ToolPathOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.ToolPathOptionName)),
                           Create.Option(
                               "--version",
                               LocalizableStrings.VersionOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.VersionOptionName)),
                           Create.Option(
                               "--configfile",
                               LocalizableStrings.ConfigFileOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.ConfigFileOptionName)),
                           Create.Option(
                               "--add-source",
                               LocalizableStrings.AddSourceOptionDescription,
                               Accept.OneOrMoreArguments()
                               .With(name: LocalizableStrings.AddSourceOptionName)),
                           Create.Option(
                               "--framework",
                               LocalizableStrings.FrameworkOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.FrameworkOptionName)),
                           CommonOptions.HelpOption(),
                           CommonOptions.VerbosityOption()));
 }
        public static Command GetCommand()
        {
            var command = new Command("publish", LocalizableStrings.AppDescription);

            command.AddArgument(SlnOrProjectArgument);
            RestoreCommandParser.AddImplicitRestoreOptions(command, includeRuntimeOption: false, includeNoDependenciesOption: true);
            command.AddOption(OuputOption);
            command.AddOption(ManifestOption);
            command.AddOption(NoBuildOption);
            command.AddOption(SelfContainedOption);
            command.AddOption(NoSelfContainedOption);
            command.AddOption(NoLogoOption);
            command.AddOption(CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription));
            command.AddOption(CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription));
            command.AddOption(CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription));
            command.AddOption(CommonOptions.VersionSuffixOption());
            command.AddOption(CommonOptions.InteractiveMsBuildForwardOption());
            command.AddOption(NoRestoreOption);
            command.AddOption(CommonOptions.VerbosityOption());

            return(command);
        }
 public static Command ListPackageReferences() => Create.Command(
     "package",
     LocalizableStrings.AppFullName,
     Accept.NoArguments(),
     CommonOptions.HelpOption(),
     Create.Option("--outdated",
                   LocalizableStrings.CmdOutdatedDescription,
                   Accept.NoArguments().ForwardAs("--outdated")),
     Create.Option("--framework",
                   LocalizableStrings.CmdFrameworkDescription,
                   Accept.OneOrMoreArguments()
                   .With(name: LocalizableStrings.CmdFramework)
                   .ForwardAsMany(o => ForwardedArguments("--framework", o.Arguments))),
     Create.Option("--include-transitive",
                   LocalizableStrings.CmdTransitiveDescription,
                   Accept.NoArguments().ForwardAs("--include-transitive")),
     Create.Option("--include-prerelease",
                   LocalizableStrings.CmdPrereleaseDescription,
                   Accept.NoArguments().ForwardAs("--include-prerelease")),
     Create.Option("--highest-patch",
                   LocalizableStrings.CmdHighestPatchDescription,
                   Accept.NoArguments().ForwardAs("--highest-patch")),
     Create.Option("--highest-minor",
                   LocalizableStrings.CmdHighestMinorDescription,
                   Accept.NoArguments().ForwardAs("--highest-minor")),
     Create.Option("--config",
                   LocalizableStrings.CmdConfigDescription,
                   Accept.ExactlyOneArgument()
                   .With(name: LocalizableStrings.CmdConfig)
                   .ForwardAsMany(o => new [] { "--config", o.Arguments.Single() })),
     Create.Option("--source",
                   LocalizableStrings.CmdSourceDescription,
                   Accept.OneOrMoreArguments()
                   .With(name: LocalizableStrings.CmdSource)
                   .ForwardAsMany(o => ForwardedArguments("--source", o.Arguments))),
     Create.Option("--interactive",
                   CommonLocalizableStrings.CommandInteractiveOptionDescription,
                   Accept.NoArguments().ForwardAs("--interactive")));
 public static Command ToolUpdate()
 {
     return(Create.Command("update",
                           LocalizableStrings.CommandDescription,
                           Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageId)
                           .With(name: LocalizableStrings.PackageIdArgumentName,
                                 description: LocalizableStrings.PackageIdArgumentDescription),
                           Create.Option(
                               "-g|--global",
                               LocalizableStrings.GlobalOptionDescription,
                               Accept.NoArguments()),
                           Create.Option(
                               "--tool-path",
                               LocalizableStrings.ToolPathOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.ToolPathOptionName)),
                           Create.Option(
                               "--configfile",
                               LocalizableStrings.ConfigFileOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.ConfigFileOptionName)),
                           Create.Option(
                               "--add-source",
                               LocalizableStrings.AddSourceOptionDescription,
                               Accept.OneOrMoreArguments()
                               .With(name: LocalizableStrings.AddSourceOptionName)),
                           Create.Option(
                               "--framework",
                               LocalizableStrings.FrameworkOptionDescription,
                               Accept.ExactlyOneArgument()
                               .With(name: LocalizableStrings.FrameworkOptionName)),
                           ToolCommandRestorePassThroughOptions.DisableParallelOption(),
                           ToolCommandRestorePassThroughOptions.IgnoreFailedSourcesOption(),
                           ToolCommandRestorePassThroughOptions.NoCacheOption(),
                           ToolCommandRestorePassThroughOptions.InteractiveRestoreOption(),
                           CommonOptions.HelpOption(),
                           CommonOptions.VerbosityOption()));
 }
Example #8
0
 public static Command Run() =>
 Create.Command(
     "run",
     LocalizableStrings.AppFullName,
     treatUnmatchedTokensAsErrors: false,
     arguments: Accept.ZeroOrMoreArguments()
     .MaterializeAs(o => new RunCommand
                    (
                        configuration: o.SingleArgumentOrDefault("--configuration"),
                        framework: o.SingleArgumentOrDefault("--framework"),
                        noBuild: o.HasOption("--no-build"),
                        project: o.SingleArgumentOrDefault("--project"),
                        launchProfile: o.SingleArgumentOrDefault("--launch-profile"),
                        noLaunchProfile: o.HasOption("--no-launch-profile"),
                        args: o.Arguments
                    )),
     options: new[]
 {
     CommonOptions.HelpOption(),
     CommonOptions.ConfigurationOption(),
     CommonOptions.FrameworkOption(),
     Create.Option(
         "-p|--project",
         LocalizableStrings.CommandOptionProjectDescription,
         Accept.ExactlyOneArgument()),
     Create.Option(
         "--launch-profile",
         LocalizableStrings.CommandOptionLaunchProfileDescription,
         Accept.ExactlyOneArgument()),
     Create.Option(
         "--no-launch-profile",
         LocalizableStrings.CommandOptionNoLaunchProfileDescription,
         Accept.NoArguments()),
     Create.Option(
         "--no-build",
         LocalizableStrings.CommandOptionNoBuildDescription,
         Accept.NoArguments())
 });
Example #9
0
 public static Command Clean() =>
 Create.Command(
     "clean",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.SolutionOrProjectArgumentName,
           description: CommonLocalizableStrings.SolutionOrProjectArgumentDescription),
     CommonOptions.HelpOption(),
     Create.Option("-o|--output",
                   LocalizableStrings.CmdOutputDirDescription,
                   Accept.ExactlyOneArgument()
                   .With(name: LocalizableStrings.CmdOutputDir)
                   .ForwardAsSingle(o => $"-property:OutputPath={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
     Create.Option(
         "--nologo|/nologo",
         LocalizableStrings.CmdNoLogo,
         Accept.NoArguments()
         .ForwardAs("-nologo")),
     CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
     CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
     CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
     CommonOptions.InteractiveMsBuildForwardOption(),
     CommonOptions.VerbosityOption());
Example #10
0
 public static Command Publish() =>
 Create.Command(
     "publish",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments(),
     CommonOptions.HelpOption(),
     CommonOptions.FrameworkOption(),
     CommonOptions.RuntimeOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.OutputOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.OutputOption)
         .ForwardAsSingle(o => $"/p:PublishDir={o.Arguments.Single()}")),
     CommonOptions.ConfigurationOption(),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "--filter",
         LocalizableStrings.FilterProjOptionDescription,
         Accept.OneOrMoreArguments()
         .With(name: LocalizableStrings.FilterProjOption)
         .ForwardAsSingle(o => $"/p:FilterProjectFiles={string.Join("%3B", o.Arguments)}")),
     CommonOptions.VerbosityOption());
Example #11
0
 public static Command AddPackage()
 {
     return(Create.Command(
                "package",
                LocalizableStrings.AppFullName,
                Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageReference)
                .WithSuggestionsFrom(QueryNuGet)
                .With(name: LocalizableStrings.CmdPackage,
                      description: LocalizableStrings.CmdPackageDescription),
                CommonOptions.HelpOption(),
                Create.Option("-v|--version",
                              LocalizableStrings.CmdVersionDescription,
                              Accept.ExactlyOneArgument()
                              .With(name: LocalizableStrings.CmdVersion)
                              .ForwardAsSingle(o => $"--version {o.Arguments.Single()}")),
                Create.Option("-f|--framework",
                              LocalizableStrings.CmdFrameworkDescription,
                              Accept.ExactlyOneArgument()
                              .With(name: LocalizableStrings.CmdFramework)
                              .ForwardAsSingle(o => $"--framework {o.Arguments.Single()}")),
                Create.Option("-n|--no-restore",
                              LocalizableStrings.CmdNoRestoreDescription),
                Create.Option("-s|--source",
                              LocalizableStrings.CmdSourceDescription,
                              Accept.ExactlyOneArgument()
                              .With(name: LocalizableStrings.CmdSource)
                              .ForwardAsSingle(o => $"--source {o.Arguments.Single()}")),
                Create.Option("--package-directory",
                              LocalizableStrings.CmdPackageDirectoryDescription,
                              Accept.ExactlyOneArgument()
                              .With(name: LocalizableStrings.CmdPackageDirectory)
                              .ForwardAsSingle(o => $"--package-directory {o.Arguments.Single()}")),
                Create.Option("--interactive",
                              CommonLocalizableStrings.CommandInteractiveOptionDescription,
                              Accept.NoArguments()
                              .ForwardAs("--interactive"))));
 }
Example #12
0
        private static Command GetSignCommand()
        {
            var signCommand = new Command("sign");

            signCommand.AddArgument(new Argument <IEnumerable <string> >()
            {
                Arity = ArgumentArity.OneOrMore
            });

            signCommand.AddOption(new Option <string>(new string[] { "-o", "--output" }));
            signCommand.AddOption(new Option <string>("--certificate-path"));
            signCommand.AddOption(new Option <string>("--certificate-store-name"));
            signCommand.AddOption(new Option <string>("--certificate-store-location"));
            signCommand.AddOption(new Option <string>("--certificate-subject-name"));
            signCommand.AddOption(new Option <string>("--certificate-fingerprint"));
            signCommand.AddOption(new Option <string>("--certificate-password"));
            signCommand.AddOption(new Option <string>("--hash-algorithm"));
            signCommand.AddOption(new Option <string>("--timestamper"));
            signCommand.AddOption(new Option <string>("--timestamp-hash-algorithm"));
            signCommand.AddOption(new Option <bool>("--overwrite"));
            signCommand.AddOption(CommonOptions.VerbosityOption());

            return(signCommand);
        }
Example #13
0
 public static Command Migrate() =>
 Create.Command(
     "migrate",
     ".NET Migrate Command",
     Accept.ZeroOrOneArgument()
     .MaterializeAs(o =>
                    new MigrateCommand(
                        o.ValueOrDefault <string>("--template-file"),
                        o.Arguments.FirstOrDefault(),
                        o.ValueOrDefault <string>("--sdk-package-version"),
                        o.ValueOrDefault <string>("--xproj-file"),
                        o.ValueOrDefault <string>("--report-file"),
                        o.ValueOrDefault <bool>("--skip-project-references"),
                        o.ValueOrDefault <bool>("--format-report-file-json"),
                        o.ValueOrDefault <bool>("--skip-backup")))
     .With(name: LocalizableStrings.CmdProjectArgument,
           description: LocalizableStrings.CmdProjectArgumentDescription),
     CommonOptions.HelpOption(),
     Create.Option("-t|--template-file",
                   LocalizableStrings.CmdTemplateDescription,
                   Accept.ExactlyOneArgument()),
     Create.Option("-v|--sdk-package-version",
                   LocalizableStrings.CmdVersionDescription,
                   Accept.ExactlyOneArgument()),
     Create.Option("-x|--xproj-file",
                   LocalizableStrings.CmdXprojFileDescription,
                   Accept.ExactlyOneArgument()),
     Create.Option("-s|--skip-project-references",
                   LocalizableStrings.CmdSkipProjectReferencesDescription),
     Create.Option("-r|--report-file",
                   LocalizableStrings.CmdReportFileDescription,
                   Accept.ExactlyOneArgument()),
     Create.Option("--format-report-file-json",
                   LocalizableStrings.CmdReportOutputDescription),
     Create.Option("--skip-backup",
                   LocalizableStrings.CmdSkipBackupDescription));
        private static Option[] FullRestoreOptions()
        {
            var fullRestoreOptions = AddImplicitRestoreOptions(new Option[] { CommonOptions.HelpOption() }, true, true);

            return(fullRestoreOptions.Concat(new Option[] { CommonOptions.VerbosityOption() }).ToArray());
        }
Example #15
0
        internal static IEnumerable <string> ResolveOsOptionToRuntimeIdentifier(string arg, ParseResult parseResult)
        {
            if (parseResult.HasOption(RuntimeOption(string.Empty).Aliases.First()))
            {
                throw new GracefulException(CommonLocalizableStrings.CannotSpecifyBothRuntimeAndOsOptions);
            }

            var selfContainedSpecified = parseResult.HasOption(SelfContainedOption().Aliases.First()) || parseResult.HasOption(NoSelfContainedOption().Aliases.First());

            if (parseResult.BothArchAndOsOptionsSpecified())
            {
                return(ResolveRidShorthandOptions(arg, parseResult.ValueForOption <string>(CommonOptions.ArchitectureOption().Aliases.First()), selfContainedSpecified));
            }

            return(ResolveRidShorthandOptions(arg, null, selfContainedSpecified));
        }
Example #16
0
        public static Command Test() =>
        Create.Command(
            "test",
            LocalizableStrings.AppFullName,
            Accept.ZeroOrMoreArguments()
            .With(name: LocalizableStrings.CmdArgProject,
                  description: LocalizableStrings.CmdArgDescription),
            CommonOptions.HelpOption(),
            Create.Option(
                "-s|--settings",
                LocalizableStrings.CmdSettingsDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdSettingsFile)
                .ForwardAsSingle(o => $"/p:VSTestSetting={o.Arguments.Single()}")),
            Create.Option(
                "-t|--list-tests",
                LocalizableStrings.CmdListTestsDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "/p:VSTestListTests=true")),
            Create.Option(
                "--filter",
                LocalizableStrings.CmdTestCaseFilterDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdTestCaseFilterExpression)
                .ForwardAsSingle(o => $"/p:VSTestTestCaseFilter={o.Arguments.Single()}")),
            Create.Option(
                "-a|--test-adapter-path",
                LocalizableStrings.CmdTestAdapterPathDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdTestAdapterPath)
                .ForwardAsSingle(o => $"/p:VSTestTestAdapterPath={o.Arguments.Single()}")),
            Create.Option(
                "-l|--logger",
                LocalizableStrings.CmdLoggerDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdLoggerOption)
                .ForwardAsSingle(o =>
        {
            var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));

            return($"/p:VSTestLogger={loggersString}");
        })),
            CommonOptions.ConfigurationOption(),
            CommonOptions.FrameworkOption(),
            Create.Option(
                "-o|--output",
                LocalizableStrings.CmdOutputDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdOutputDir)
                .ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")),
            Create.Option(
                "-d|--diag",
                LocalizableStrings.CmdPathTologFileDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdPathToLogFile)
                .ForwardAsSingle(o => $"/p:VSTestDiag={o.Arguments.Single()}")),
            Create.Option(
                "--no-build",
                LocalizableStrings.CmdNoBuildDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "/p:VSTestNoBuild=true")),
            Create.Option(
                "-r|--results-directory",
                LocalizableStrings.CmdResultsDirectoryDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdPathToResultsDirectory)
                .ForwardAsSingle(o => $"/p:VSTestResultsDirectory={o.Arguments.Single()}")),
            CommonOptions.VerbosityOption());
Example #17
0
        public static Command Store() =>
        Create.Command(
            "store",
            LocalizableStrings.AppDescription,
            Accept.ZeroOrMoreArguments(),
            CommonOptions.HelpOption(),
            Create.Option(
                "-m|--manifest",
                LocalizableStrings.ProjectManifestDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.ProjectManifest)
                .ForwardAsMany(o =>
        {
            var materializedString = $"{o.Arguments.First()}";

            if (o.Arguments.Count == 1)
            {
                return(new[]
                {
                    materializedString
                });
            }
            else
            {
                return(new[]
                {
                    materializedString,
                    $"/p:AdditionalProjects={string.Join("%3B", o.Arguments.Skip(1))}"
                });
            }
        })),
            CommonOptions.FrameworkOption(),
            Create.Option(
                "--framework-version",
                LocalizableStrings.FrameworkVersionOptionDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.FrameworkVersionOption)
                .ForwardAsSingle(o => $"/p:RuntimeFrameworkVersion={o.Arguments.Single()}")),
            CommonOptions.RuntimeOption(),
            CommonOptions.ConfigurationOption(),
            Create.Option(
                "-o|--output",
                LocalizableStrings.OutputOptionDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.OutputOption)
                .ForwardAsSingle(o => $"/p:ComposeDir={Path.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "-w|--working-dir",
                LocalizableStrings.IntermediateWorkingDirOptionDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.IntermediateWorkingDirOption)
                .ForwardAsSingle(o => $"/p:ComposeWorkingDir={o.Arguments.Single()}")),
            Create.Option(
                "--preserve-working-dir",
                LocalizableStrings.PreserveIntermediateWorkingDirOptionDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => $"/p:PreserveComposeWorkingDir=true")),
            Create.Option(
                "--skip-optimization",
                LocalizableStrings.SkipOptimizationOptionDescription,
                Accept.NoArguments()
                .ForwardAs("/p:SkipOptimization=true")),
            CommonOptions.VerbosityOption());
Example #18
0
        public static Command Test() =>
        Create.Command(
            "test",
            LocalizableStrings.AppFullName,
            Accept.ZeroOrMoreArguments()
            .With(name: CommonLocalizableStrings.ProjectArgumentName,
                  description: CommonLocalizableStrings.ProjectArgumentDescription),
            false,
            CommonOptions.HelpOption(),
            Create.Option(
                "-s|--settings",
                LocalizableStrings.CmdSettingsDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdSettingsFile)
                .ForwardAsSingle(o => $"-property:VSTestSetting={o.Arguments.Single()}")),
            Create.Option(
                "-t|--list-tests",
                LocalizableStrings.CmdListTestsDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestListTests=true")),
            Create.Option(
                "--filter",
                LocalizableStrings.CmdTestCaseFilterDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdTestCaseFilterExpression)
                .ForwardAsSingle(o => $"-property:VSTestTestCaseFilter={o.Arguments.Single()}")),
            Create.Option(
                "-a|--test-adapter-path",
                LocalizableStrings.CmdTestAdapterPathDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.CmdTestAdapterPath)
                .ForwardAsSingle(o => $"-property:VSTestTestAdapterPath=\"{string.Join(";", o.Arguments)}\"")),
            Create.Option(
                "-l|--logger",
                LocalizableStrings.CmdLoggerDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.CmdLoggerOption)
                .ForwardAsSingle(o =>
        {
            var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));

            return($"-property:VSTestLogger=\"{loggersString}\"");
        })),
            CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
            CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
            CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription, withShortOption: false),
            Create.Option(
                "-o|--output",
                LocalizableStrings.CmdOutputDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdOutputDir)
                .ForwardAsSingle(o => $"-property:OutputPath={o.Arguments.Single()}")),
            Create.Option(
                "-d|--diag",
                LocalizableStrings.CmdPathTologFileDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdPathToLogFile)
                .ForwardAsSingle(o => $"-property:VSTestDiag={o.Arguments.Single()}")),
            Create.Option(
                "--no-build",
                LocalizableStrings.CmdNoBuildDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestNoBuild=true")),
            Create.Option(
                "-r|--results-directory",
                LocalizableStrings.CmdResultsDirectoryDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdPathToResultsDirectory)
                .ForwardAsSingle(o => $"-property:VSTestResultsDirectory={o.Arguments.Single()}")),
            Create.Option(
                "--collect",
                LocalizableStrings.cmdCollectDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.cmdCollectFriendlyName)
                .ForwardAsSingle(o => $"-property:VSTestCollect=\"{string.Join(";", o.Arguments)}\"")),
            Create.Option(
                "--blame",
                LocalizableStrings.CmdBlameDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestBlame=true")),
            CommonOptions.NoRestoreOption(),
            CommonOptions.VerbosityOption());
Example #19
0
 public static Command RemovePackage() =>
 Create.Command(
     "package",
     LocalizableStrings.AppFullName,
     CommonOptions.HelpOption());
Example #20
0
        public static Command Store() =>
        Create.Command(
            "store",
            LocalizableStrings.AppDescription,
            Accept.ZeroOrMoreArguments(),
            CommonOptions.HelpOption(),
            Create.Option(
                "-m|--manifest",
                LocalizableStrings.ProjectManifestDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.ProjectManifest)
                .ForwardAsMany(o =>
        {
            // the first path doesn't need to go through CommandDirectoryContext.ExpandPath
            // since it is a direct argument to MSBuild, not a property
            var materializedString = $"{o.Arguments.First()}";

            if (o.Arguments.Count == 1)
            {
                return(new[]
                {
                    materializedString
                });
            }
            else
            {
                return(new[]
                {
                    materializedString,
                    $"-property:AdditionalProjects={string.Join("%3B", o.Arguments.Skip(1).Select(CommandDirectoryContext.GetFullPath))}"
                });
            }
        })),
            CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
            Create.Option(
                "--framework-version",
                LocalizableStrings.FrameworkVersionOptionDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.FrameworkVersionOption)
                .ForwardAsSingle(o => $"-property:RuntimeFrameworkVersion={o.Arguments.Single()}")),
            CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
            Create.Option(
                "-o|--output",
                LocalizableStrings.OutputOptionDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.OutputOption)
                .ForwardAsSingle(o => $"-property:ComposeDir={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "-w|--working-dir",
                LocalizableStrings.IntermediateWorkingDirOptionDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.IntermediateWorkingDirOption)
                .ForwardAsSingle(o => $"-property:ComposeWorkingDir={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "--skip-optimization",
                LocalizableStrings.SkipOptimizationOptionDescription,
                Accept.NoArguments()
                .ForwardAs("-property:SkipOptimization=true")),
            Create.Option(
                "--skip-symbols",
                LocalizableStrings.SkipSymbolsOptionDescription,
                Accept.NoArguments()
                .ForwardAs("-property:CreateProfilingSymbols=false")),
            CommonOptions.VerbosityOption());
Example #21
0
        public static Command Test() =>
        Create.Command(
            "test",
            LocalizableStrings.AppFullName,
            Accept.ZeroOrMoreArguments()
            .With(name: CommonLocalizableStrings.SolutionOrProjectArgumentName,
                  description: CommonLocalizableStrings.SolutionOrProjectArgumentDescription),
            false,
            CommonOptions.HelpOption(),
            Create.Option(
                "-s|--settings",
                LocalizableStrings.CmdSettingsDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdSettingsFile)
                .ForwardAsSingle(o => $"-property:VSTestSetting={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "-t|--list-tests",
                LocalizableStrings.CmdListTestsDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestListTests=true")),
            Create.Option(
                "--filter",
                LocalizableStrings.CmdTestCaseFilterDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdTestCaseFilterExpression)
                .ForwardAsSingle(o => $"-property:VSTestTestCaseFilter={o.Arguments.Single()}")),
            Create.Option(
                "-a|--test-adapter-path",
                LocalizableStrings.CmdTestAdapterPathDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.CmdTestAdapterPath)
                .ForwardAsSingle(o => $"-property:VSTestTestAdapterPath=\"{string.Join(";", o.Arguments.Select(CommandDirectoryContext.GetFullPath))}\"")),
            Create.Option(
                "-l|--logger",
                LocalizableStrings.CmdLoggerDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.CmdLoggerOption)
                .ForwardAsSingle(o =>
        {
            var loggersString = string.Join(";", GetSemiColonEscapedArgs(o.Arguments));

            return($"-property:VSTestLogger=\"{loggersString}\"");
        })),
            CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
            CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
            CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription, withShortOption: false),
            Create.Option(
                "-o|--output",
                LocalizableStrings.CmdOutputDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdOutputDir)
                .ForwardAsSingle(o => $"-property:OutputPath={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "-d|--diag",
                LocalizableStrings.CmdPathTologFileDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdPathToLogFile)
                .ForwardAsSingle(o => $"-property:VSTestDiag={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "--no-build",
                LocalizableStrings.CmdNoBuildDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestNoBuild=true")),
            Create.Option(
                "-r|--results-directory",
                LocalizableStrings.CmdResultsDirectoryDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.CmdPathToResultsDirectory)
                .ForwardAsSingle(o => $"-property:VSTestResultsDirectory={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
            Create.Option(
                "--collect",
                LocalizableStrings.cmdCollectDescription,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.cmdCollectFriendlyName)
                .ForwardAsSingle(o => $"-property:VSTestCollect=\"{string.Join(";", o.Arguments)}\"")),
            Create.Option(
                "--blame",
                LocalizableStrings.CmdBlameDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestBlame=true")),
            Create.Option(
                "--blame-crash",
                LocalizableStrings.CmdBlameCrashDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestBlameCrash=true")),
            Create.Option(
                "--blame-crash-dump-type",
                LocalizableStrings.CmdBlameCrashDumpTypeDescription,
                Accept.AnyOneOf(
                    "full",
                    "mini")
                .With(name: LocalizableStrings.CrashDumpTypeArgumentName, defaultValue: () => "full")
                .ForwardAsMany(o => new[] {
            "-property:VSTestBlameCrash=true",
            $"-property:VSTestBlameCrashDumpType={o.Arguments.Single()}"
        })),
            Create.Option(
                "--blame-crash-collect-always",
                LocalizableStrings.CmdBlameCrashCollectAlwaysDescription,
                Accept.NoArguments()
                .ForwardAsMany(o => new[] {
            "-property:VSTestBlameCrash=true",
            "-property:VSTestBlameCrashCollectAlways=true"
        })),
            Create.Option(
                "--blame-hang",
                LocalizableStrings.CmdBlameHangDescription,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestBlameHang=true")),
            Create.Option(
                "--blame-hang-dump-type",
                LocalizableStrings.CmdBlameHangDumpTypeDescription,
                Accept.AnyOneOf(
                    "full",
                    "mini",
                    "none")
                .With(name: LocalizableStrings.HangDumpTypeArgumentName, defaultValue: () => "full")
                .ForwardAsMany(o => new[] {
            "-property:VSTestBlameHang=true",
            $"-property:VSTestBlameHangDumpType={o.Arguments.Single()}"
        })),
            Create.Option(
                "--blame-hang-timeout",
                LocalizableStrings.CmdBlameHangTimeoutDescription,
                Accept.ExactlyOneArgument()
                .With(name: LocalizableStrings.HangTimeoutArgumentName)
                .ForwardAsMany(o => new[] {
            "-property:VSTestBlameHang=true",
            $"-property:VSTestBlameHangTimeout={o.Arguments.Single()}"
        })),

            Create.Option(
                "--nologo|/nologo",
                LocalizableStrings.CmdNoLogo,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestNoLogo=nologo")),
            CommonOptions.NoRestoreOption(),
            CommonOptions.InteractiveMsBuildForwardOption(),
            CommonOptions.VerbosityOption());
Example #22
0
        private static Option[] ImplicitRestoreOptions(bool showHelp, bool useShortOptions, bool includeRuntimeOption, bool includeNoDependenciesOption)
        {
            var options = new Option[] {
                new ForwardedOption <IEnumerable <string> >(
                    useShortOptions ? new string[] { "-s", "--source" }  : new string[] { "--source" },
                    showHelp ? LocalizableStrings.CmdSourceOptionDescription : string.Empty)
                {
                    ArgumentHelpName = LocalizableStrings.CmdSourceOption,
                    IsHidden         = !showHelp
                }.ForwardAsSingle(o => $"-property:RestoreSources={string.Join("%3B", o)}")
                .AllowSingleArgPerToken(),
                new ForwardedOption <string>(
                    "--packages",
                    showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty)
                {
                    ArgumentHelpName = LocalizableStrings.CmdPackagesOption,
                    IsHidden         = !showHelp
                }.ForwardAsSingle(o => $"-property:RestorePackagesPath={CommandDirectoryContext.GetFullPath(o)}"),
                CommonOptions.CurrentRuntimeOption(LocalizableStrings.CmdCurrentRuntimeOptionDescription),
                new ForwardedOption <bool>(
                    "--disable-parallel",
                    showHelp ? LocalizableStrings.CmdDisableParallelOptionDescription : string.Empty)
                {
                    IsHidden = !showHelp
                }.ForwardAs("-property:RestoreDisableParallel=true"),
                new ForwardedOption <string>(
                    "--configfile",
                    showHelp ? LocalizableStrings.CmdConfigFileOptionDescription : string.Empty)
                {
                    ArgumentHelpName = LocalizableStrings.CmdConfigFileOption,
                    IsHidden         = !showHelp
                }.ForwardAsSingle(o => $"-property:RestoreConfigFile={CommandDirectoryContext.GetFullPath(o)}"),
                new ForwardedOption <bool>(
                    "--no-cache",
                    showHelp ? LocalizableStrings.CmdNoCacheOptionDescription : string.Empty)
                {
                    IsHidden = !showHelp
                }.ForwardAs("-property:RestoreNoCache=true"),
                new ForwardedOption <bool>(
                    "--ignore-failed-sources",
                    showHelp ? LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription : string.Empty)
                {
                    IsHidden = !showHelp
                }.ForwardAs("-property:RestoreIgnoreFailedSources=true"),
                new ForwardedOption <bool>(
                    useShortOptions ? new string[] { "-f", "--force" } : new string[] { "--force" },
                    LocalizableStrings.CmdForceRestoreOptionDescription)
                {
                    IsHidden = !showHelp
                }.ForwardAs("-property:RestoreForce=true"),
                CommonOptions.PropertiesOption()
            };

            if (includeRuntimeOption)
            {
                options = options.Append(
                    new ForwardedOption <IEnumerable <string> >(
                        useShortOptions ? new string[] { "-r", "--runtime" } : new string[] { "--runtime" },
                        LocalizableStrings.CmdRuntimeOptionDescription)
                {
                    ArgumentHelpName = LocalizableStrings.CmdRuntimeOption,
                    IsHidden         = !showHelp
                }.ForwardAsSingle(o => $"-property:RuntimeIdentifiers={string.Join("%3B", o)}")
                    .AllowSingleArgPerToken()
                    .AddSuggestions(Suggest.RunTimesFromProjectFile())
                    ).ToArray();
            }

            if (includeNoDependenciesOption)
            {
                options = options.Append(
                    new ForwardedOption <bool>(
                        "--no-dependencies",
                        LocalizableStrings.CmdNoDependenciesOptionDescription)
                {
                    IsHidden = !showHelp
                }.ForwardAs("-property:RestoreRecursive=false")
                    ).ToArray();
            }

            return(options);
        }
Example #23
0
 internal static string GetCommandLineRuntimeIdentifier(this ParseResult parseResult)
 {
     return(parseResult.HasOption(RunCommandParser.RuntimeOption) ?
            parseResult.ValueForOption <string>(RunCommandParser.RuntimeOption) :
            parseResult.HasOption(CommonOptions.OperatingSystemOption().Aliases.First()) || parseResult.HasOption(CommonOptions.ArchitectureOption().Aliases.First()) ?
            CommonOptions.ResolveRidShorthandOptionsToRuntimeIdentifier(
                parseResult.ValueForOption <string>(CommonOptions.OperatingSystemOption().Aliases.First()),
                parseResult.ValueForOption <string>(CommonOptions.ArchitectureOption().Aliases.First())) :
            null);
 }
Example #24
0
 public static Command SlnList() =>
 Create.Command("list",
                LocalizableStrings.ListAppFullName,
                CommonOptions.HelpOption());
Example #25
0
 public static Command NuGet() =>
 Create.Command("nuget",
                "NuGet Command Line 4.0.0.0",
                CommonOptions.HelpOption(),
                Create.Option("--version",
                              "Show version information"),
                Create.Option("-v|--verbosity",
                              "The verbosity of logging to use. Allowed values: Debug, Verbose, Information, Minimal, Warning, Error.",
                              Accept.ExactlyOneArgument()
                              .With(name: "verbosity")),
                Create.Command("delete",
                               "Deletes a package from the server.",
                               Accept.ExactlyOneArgument()
                               .With(name: "root",
                                     description: "The Package Id and version."),
                               CommonOptions.HelpOption(),
                               Create.Option("--force-english-output",
                                             "Forces the application to run using an invariant, English-based culture."),
                               Create.Option("-s|--source",
                                             "Specifies the server URL",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "source")),
                               Create.Option("--non-interactive",
                                             "Do not prompt for user input or confirmations."),
                               Create.Option("-k|--api-key",
                                             "The API key for the server.",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "apiKey"))),
                Create.Command("locals",
                               "Clears or lists local NuGet resources such as http requests cache, packages cache or machine-wide global packages folder.",
                               Accept.AnyOneOf(@"all",
                                               @"http-cache",
                                               @"global-packages",
                                               @"temp")
                               .With(description: "Cache Location(s)  Specifies the cache location(s) to list or clear."),
                               CommonOptions.HelpOption(),
                               Create.Option("--force-english-output",
                                             "Forces the application to run using an invariant, English-based culture."),
                               Create.Option("-c|--clear", "Clear the selected local resources or cache location(s)."),
                               Create.Option("-l|--list", "List the selected local resources or cache location(s).")),
                Create.Command("push",
                               "Pushes a package to the server and publishes it.",
                               CommonOptions.HelpOption(),
                               Create.Option("--force-english-output",
                                             "Forces the application to run using an invariant, English-based culture."),
                               Create.Option("-s|--source",
                                             "Specifies the server URL",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "source")),
                               Create.Option("-ss|--symbol-source",
                                             "Specifies the symbol server URL. If not specified, nuget.smbsrc.net is used when pushing to nuget.org.",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "source")),
                               Create.Option("-t|--timeout",
                                             "Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "timeout")),
                               Create.Option("-k|--api-key", "The API key for the server.",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "apiKey")),
                               Create.Option("-sk|--symbol-api-key", "The API key for the symbol server.",
                                             Accept.ExactlyOneArgument()
                                             .With(name: "apiKey")),
                               Create.Option("-d|--disable-buffering",
                                             "Disable buffering when pushing to an HTTP(S) server to decrease memory usage."),
                               Create.Option("-n|--no-symbols",
                                             "If a symbols package exists, it will not be pushed to a symbols server.")));
Example #26
0
 public static bool BothArchAndOsOptionsSpecified(this ParseResult parseResult) =>
 parseResult.HasOption(CommonOptions.ArchitectureOption().Aliases.First()) &&
 parseResult.HasOption(CommonOptions.OperatingSystemOption().Aliases.First());