Beispiel #1
0
 public static Command Publish() =>
 CreateWithRestoreOptions.Command(
     "publish",
     LocalizableStrings.AppDescription,
     Accept.ZeroOrMoreArguments(),
     CommonOptions.HelpOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.OutputOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.OutputOption)
         .ForwardAsSingle(o => $"/p:PublishDir={o.Arguments.Single()}")),
     CommonOptions.FrameworkOption(),
     CommonOptions.RuntimeOption(),
     CommonOptions.ConfigurationOption(),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "--manifest",
         LocalizableStrings.ManifestOptionDescription,
         Accept.OneOrMoreArguments()
         .With(name: LocalizableStrings.ManifestOption)
         .ForwardAsSingle(o => $"/p:TargetManifestFiles={string.Join("%3B", o.Arguments)}")),
     Create.Option(
         "--self-contained",
         LocalizableStrings.SelfContainedOptionDescription,
         Accept.ZeroOrOneArgument()
         .WithSuggestionsFrom("true", "false")
         .ForwardAsSingle(o =>
 {
     string value = o.Arguments.Any() ? o.Arguments.Single() : "true";
     return($"/p:SelfContained={value}");
 })),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
Beispiel #2
0
 public static Command Pack() =>
 CreateWithRestoreOptions.Command(
     "pack",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.ProjectArgumentName,
           description: CommonLocalizableStrings.ProjectArgumentDescription),
     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")),
     CommonOptions.InteractiveMsBuildForwardOption(),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
Beispiel #3
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"),
     Args          = o.Arguments
 }),
     options: new[]
 {
     CommonOptions.HelpOption(),
     CommonOptions.ConfigurationOption(),
     CommonOptions.FrameworkOption(),
     Create.Option(
         "-p|--project",
         LocalizableStrings.CommandOptionProjectDescription,
         Accept.ExactlyOneArgument()),
     Create.Option(
         "--no-build",
         LocalizableStrings.CommandOptionNoBuildDescription,
         Accept.NoArguments())
 });
 public static Command Build() =>
 CreateWithRestoreOptions.Command(
     "build",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.CmdProjectFile,
           description:
           "The MSBuild project file to build. If a project file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in `proj` and uses that file."),
     CommonOptions.HelpOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.OutputOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.OutputOptionName)
         .ForwardAsSingle(o => $"-property:OutputPath={o.Arguments.Single()}")),
     CommonOptions.FrameworkOption(),
     CommonOptions.RuntimeOption(),
     CommonOptions.ConfigurationOption(),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "--no-incremental",
         LocalizableStrings.NoIncrementialOptionDescription),
     Create.Option(
         "--no-dependencies",
         LocalizableStrings.NoDependenciesOptionDescription,
         Accept.NoArguments()
         .ForwardAs("-property:BuildProjectReferences=false")),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
 public static Command Pack() =>
 Create.Command(
     "pack",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments(),
     CommonOptions.HelpOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.CmdOutputDirDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.CmdOutputDir)
         .ForwardAsSingle(o => $"/p:PackageOutputPath={o.Arguments.Single()}")),
     Create.Option(
         "--no-build",
         LocalizableStrings.CmdNoBuildOptionDescription,
         Accept.NoArguments().ForwardAs("/p:NoBuild=true")),
     Create.Option(
         "--include-symbols",
         LocalizableStrings.CmdIncludeSymbolsDescription,
         Accept.NoArguments().ForwardAs("/p:IncludeSymbols=true")),
     Create.Option(
         "--include-source",
         LocalizableStrings.CmdIncludeSourceDescription,
         Accept.NoArguments().ForwardAs("/p:IncludeSource=true")),
     CommonOptions.ConfigurationOption(),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "-s|--serviceable",
         LocalizableStrings.CmdServiceableDescription,
         Accept.NoArguments().ForwardAs("/p:Serviceable=true")),
     CommonOptions.VerbosityOption());
Beispiel #6
0
 public static Command Build() =>
 CreateWithRestoreOptions.Command(
     "build",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.ProjectArgumentName,
           description: CommonLocalizableStrings.ProjectArgumentDescription),
     CommonOptions.HelpOption(),
     Create.Option(
         "-o|--output",
         LocalizableStrings.OutputOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.OutputOptionName)
         .ForwardAsSingle(o => $"-property:OutputPath={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
     CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
     CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
     CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
     CommonOptions.VersionSuffixOption(),
     Create.Option(
         "--no-incremental",
         LocalizableStrings.NoIncrementalOptionDescription),
     Create.Option(
         "--no-dependencies",
         LocalizableStrings.NoDependenciesOptionDescription,
         Accept.NoArguments()
         .ForwardAs("-property:BuildProjectReferences=false")),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
Beispiel #7
0
 public static Command ToolSearch()
 {
     return(Create.Command(
                "search",
                LocalizableStrings.CommandDescription,
                Accept.ZeroOrMoreArguments()
                .With(name: LocalizableStrings.SearchTermArgumentName,
                      description: LocalizableStrings.SearchTermDescription),
                Create.Option(
                    $"--detail",
                    LocalizableStrings.DetailDescription,
                    Accept.NoArguments()),
                Create.Option(
                    $"--skip",
                    LocalizableStrings.SkipDescription,
                    Accept.ExactlyOneArgument()
                    .With(name: LocalizableStrings.SkipArgumentName)),
                Create.Option(
                    $"--take",
                    LocalizableStrings.TakeDescription,
                    Accept.ExactlyOneArgument()
                    .With(name: LocalizableStrings.TakeArgumentName)),
                Create.Option(
                    $"--prerelease",
                    LocalizableStrings.PrereleaseDescription,
                    Accept.NoArguments()),
                Create.Option(
                    $"--semver-level",
                    LocalizableStrings.SemVerLevelDescription,
                    Accept.ExactlyOneArgument()
                    .With(name: LocalizableStrings.SemVerLevelArgumentName)),
                CommonOptions.HelpOption()));
 }
Beispiel #8
0
 public static Command Restore() =>
 Create.Command(
     "restore",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.ProjectArgumentName,
           description: CommonLocalizableStrings.ProjectArgumentDescription),
     FullRestoreOptions());
        private static Command GetNewCommand(string commandName, params Option[][] args)
        {
            Option[] combinedArgs = ArrayExtensions.CombineArrays(args);

            return(Create.Command(commandName,
                                  LocalizableStrings.CommandDescription,
                                  Accept.ZeroOrMoreArguments(), // this can't be ZeroOrOneArguments() because template args would cause errors
                                  combinedArgs));
        }
 public static Command Restore() =>
 Create.Command(
     "restore",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments(),
     CommonOptions.HelpOption(),
     Create.Option(
         "-s|--source",
         LocalizableStrings.CmdSourceOptionDescription,
         Accept.OneOrMoreArguments()
         .With(name: LocalizableStrings.CmdSourceOption)
         .ForwardAsSingle(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")),
     Create.Option(
         "-r|--runtime",
         LocalizableStrings.CmdRuntimeOptionDescription,
         Accept.OneOrMoreArguments()
         .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
         .With(name: LocalizableStrings.CmdRuntimeOption)
         .ForwardAsSingle(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
     Create.Option(
         "--packages",
         LocalizableStrings.CmdPackagesOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.CmdPackagesOption)
         .ForwardAsSingle(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")),
     Create.Option(
         "--disable-parallel",
         LocalizableStrings.CmdDisableParallelOptionDescription,
         Accept.NoArguments()
         .ForwardAs("/p:RestoreDisableParallel=true")),
     Create.Option(
         "--configfile",
         LocalizableStrings.CmdConfigFileOptionDescription,
         Accept.ExactlyOneArgument()
         .With(name: LocalizableStrings.CmdConfigFileOption)
         .ForwardAsSingle(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")),
     Create.Option(
         "--no-cache",
         LocalizableStrings.CmdNoCacheOptionDescription,
         Accept.NoArguments()
         .ForwardAs("/p:RestoreNoCache=true")),
     Create.Option(
         "--ignore-failed-sources",
         LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription,
         Accept.NoArguments()
         .ForwardAs("/p:RestoreIgnoreFailedSources=true")),
     Create.Option(
         "--no-dependencies",
         LocalizableStrings.CmdNoDependenciesOptionDescription,
         Accept.NoArguments()
         .ForwardAs("/p:RestoreRecursive=false")),
     CommonOptions.VerbosityOption());
Beispiel #11
0
        public void By_default_an_option_with_multiple_arguments_materializes_as_a_sequence_of_strings_by_default()
        {
            var command = Command("the-command", "",
                                  Option("-x", "", Accept.ZeroOrMoreArguments()));

            command.Parse("the-command -x arg1 -x arg2")["the-command"]["x"]
            .Value()
            .ShouldBeEquivalentTo(new[] { "arg1", "arg2" });

            command.Parse("the-command -x arg1")["the-command"]["x"]
            .Value()
            .ShouldBeEquivalentTo(new[] { "arg1" });
        }
Beispiel #12
0
 public static Command Clean() =>
 Create.Command(
     "clean",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments(),
     CommonOptions.HelpOption(),
     Create.Option("-o|--output",
                   LocalizableStrings.CmdOutputDirDescription,
                   Accept.ExactlyOneArgument()
                   .With(name: LocalizableStrings.CmdOutputDir)
                   .ForwardAsSingle(o => $"/p:OutputPath={o.Arguments.Single()}")),
     CommonOptions.FrameworkOption(),
     CommonOptions.ConfigurationOption(),
     CommonOptions.VerbosityOption());
Beispiel #13
0
 public static Command Publish() =>
 CreateWithRestoreOptions.Command(
     "publish",
     LocalizableStrings.AppDescription,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.SolutionOrProjectArgumentName,
           description: CommonLocalizableStrings.SolutionOrProjectArgumentDescription),
     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}");
 })),
     Create.Option(
         "--no-self-contained",
         LocalizableStrings.NoSelfContainedOptionDescription,
         Accept.NoArguments().ForwardAs("-property:SelfContained=false")),
     Create.Option(
         "--nologo",
         LocalizableStrings.CmdNoLogo,
         Accept.NoArguments()
         .ForwardAs("-nologo")),
     CommonOptions.InteractiveMsBuildForwardOption(),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
Beispiel #14
0
        public void Parse_result_diagram_helps_explain_parse_operation()
        {
            var parser = new Parser(
                Create.Command("the-command",
                               "Does the thing.",
                               Accept.ZeroOrMoreArguments(),
                               Create.Option("-x", "Specifies value x", Accept.ExactlyOneArgument()),
                               Create.Option("-y", "Specifies value y", Accept.NoArguments())));

            var result = parser.Parse("the-command -x one -y two three");

            result.Diagram()
            .Should()
            .Be("[ the-command [ -x <one> ] [ -y ] <two> <three> ]");
        }
Beispiel #15
0
 public static Command Run() =>
 CreateWithRestoreOptions.Command(
     "run",
     LocalizableStrings.AppFullName,
     treatUnmatchedTokensAsErrors: false,
     arguments: Accept.ZeroOrMoreArguments()
     .MaterializeAs(o => new RunCommand
                    (
                        configuration: o.SingleArgumentOrDefault("--configuration"),
                        framework: o.SingleArgumentOrDefault("--framework"),
                        runtime: o.SingleArgumentOrDefault("--runtime"),
                        noBuild: o.HasOption("--no-build"),
                        project: o.SingleArgumentOrDefault("--project"),
                        launchProfile: o.SingleArgumentOrDefault("--launch-profile"),
                        noLaunchProfile: o.HasOption("--no-launch-profile"),
                        noRestore: o.HasOption("--no-restore") || o.HasOption("--no-build"),
                        interactive: o.HasOption(Utils.Constants.RestoreInteractiveOption),
                        restoreArgs: o.OptionValuesToBeForwarded(),
                        args: o.Arguments
                    )),
     options: new[]
 {
     CommonOptions.HelpOption(),
     CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
     CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
     CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
     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()),
     CommonOptions.InteractiveOption(),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption()
 });
Beispiel #16
0
 public static Command Clean() =>
 Create.Command(
     "clean",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments()
     .With(name: CommonLocalizableStrings.ProjectArgumentName,
           description: CommonLocalizableStrings.ProjectArgumentDescription),
     CommonOptions.HelpOption(),
     Create.Option("-o|--output",
                   LocalizableStrings.CmdOutputDirDescription,
                   Accept.ExactlyOneArgument()
                   .With(name: LocalizableStrings.CmdOutputDir)
                   .ForwardAsSingle(o => $"-property:OutputPath={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
     CommonOptions.FrameworkOption(LocalizableStrings.FrameworkOptionDescription),
     CommonOptions.RuntimeOption(LocalizableStrings.RuntimeOptionDescription),
     CommonOptions.ConfigurationOption(LocalizableStrings.ConfigurationOptionDescription),
     CommonOptions.VerbosityOption());
Beispiel #17
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());
 public static Command Restore() =>
 Create.Command(
     "restore",
     LocalizableStrings.AppFullName,
     Accept.ZeroOrMoreArguments(),
     FullRestoreOptions());
Beispiel #19
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());
Beispiel #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 =>
        {
            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());
Beispiel #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());
Beispiel #22
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());
Beispiel #23
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());