Exemplo n.º 1
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());
Exemplo n.º 2
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());
Exemplo n.º 3
0
 private static Option[] ImplicitRestoreOptions(bool showHelp = false, bool useShortOptions = false)
 {
     return(new Option[] {
         Create.Option(
             useShortOptions ? "-s|--source" : "--source",
             showHelp ? LocalizableStrings.CmdSourceOptionDescription : string.Empty,
             Accept.OneOrMoreArguments()
             .With(name: LocalizableStrings.CmdSourceOption)
             .ForwardAsSingle(o => $"-property:RestoreSources={string.Join("%3B", o.Arguments)}")),
         Create.Option(
             useShortOptions ? "-r|--runtime" : "--runtime",
             LocalizableStrings.CmdRuntimeOptionDescription,
             Accept.OneOrMoreArguments()
             .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
             .With(name: LocalizableStrings.CmdRuntimeOption)
             .ForwardAsSingle(o => $"-property:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
         CommonOptions.CurrentRuntimeOption(LocalizableStrings.CmdCurrentRuntimeOptionDescription),
         Create.Option(
             "--packages",
             showHelp ? LocalizableStrings.CmdPackagesOptionDescription : string.Empty,
             Accept.ExactlyOneArgument()
             .With(name: LocalizableStrings.CmdPackagesOption)
             .ForwardAsSingle(o => $"-property:RestorePackagesPath={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
         Create.Option(
             "--disable-parallel",
             showHelp ? LocalizableStrings.CmdDisableParallelOptionDescription : string.Empty,
             Accept.NoArguments()
             .ForwardAs("-property:RestoreDisableParallel=true")),
         Create.Option(
             "--configfile",
             showHelp ? LocalizableStrings.CmdConfigFileOptionDescription : string.Empty,
             Accept.ExactlyOneArgument()
             .With(name: LocalizableStrings.CmdConfigFileOption)
             .ForwardAsSingle(o => $"-property:RestoreConfigFile={CommandDirectoryContext.GetFullPath(o.Arguments.Single())}")),
         Create.Option(
             "--no-cache",
             showHelp ? LocalizableStrings.CmdNoCacheOptionDescription : string.Empty,
             Accept.NoArguments()
             .ForwardAs("-property:RestoreNoCache=true")),
         Create.Option(
             "--ignore-failed-sources",
             showHelp ? LocalizableStrings.CmdIgnoreFailedSourcesOptionDescription : string.Empty,
             Accept.NoArguments()
             .ForwardAs("-property:RestoreIgnoreFailedSources=true")),
         Create.Option(
             "--no-dependencies",
             LocalizableStrings.CmdNoDependenciesOptionDescription,
             Accept.NoArguments()
             .ForwardAs("-property:RestoreRecursive=false")),
         Create.Option(
             useShortOptions ? "-f|--force" : "--force",
             LocalizableStrings.CmdForceRestoreOptionDescription,
             Accept.NoArguments()
             .ForwardAs("-property:RestoreForce=true"))
     });
 }
Exemplo n.º 4
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());
Exemplo n.º 5
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());
Exemplo n.º 6
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={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(
                "--nologo|/nologo",
                LocalizableStrings.CmdNoLogo,
                Accept.NoArguments()
                .ForwardAsSingle(o => "-property:VSTestNoLogo=nologo")),
            CommonOptions.NoRestoreOption(),
            CommonOptions.InteractiveMsBuildForwardOption(),
            CommonOptions.VerbosityOption());
Exemplo n.º 7
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);
        }
Exemplo n.º 8
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());