コード例 #1
0
ファイル: BuildCommandParser.cs プロジェクト: vip30/cli
 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.InteractiveOption(),
     CommonOptions.VerbosityOption());
コード例 #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.InteractiveOption(),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
コード例 #3
0
ファイル: RestoreCommandParser.cs プロジェクト: vip30/cli
        private static Option[] FullRestoreOptions()
        {
            var fullRestoreOptions = AddImplicitRestoreOptions(new Option[] { CommonOptions.HelpOption() }, true, true);

            return(fullRestoreOptions.Concat(
                       new Option[] {
                CommonOptions.VerbosityOption(),
                CommonOptions.InteractiveOption(),
                Create.Option(
                    "--use-lock-file",
                    LocalizableStrings.CmdUseLockFileOptionDescription,
                    Accept.NoArguments()
                    .ForwardAs("-property:RestorePackagesWithLockFile=true")),
                Create.Option(
                    "--locked-mode",
                    LocalizableStrings.CmdLockedModeOptionDescription,
                    Accept.NoArguments()
                    .ForwardAs("-property:RestoreLockedMode=true")),
                Create.Option(
                    "--lock-file-path",
                    LocalizableStrings.CmdLockFilePathOptionDescription,
                    Accept.ExactlyOneArgument()
                    .With(name: LocalizableStrings.CmdLockFilePathOption)
                    .ForwardAsSingle(o => $"-property:NuGetLockFilePath={o.Arguments.Single()}")),
                Create.Option(
                    "--force-evaluate",
                    LocalizableStrings.CmdReevaluateOptionDescription,
                    Accept.NoArguments()
                    .ForwardAs("-property:RestoreForceEvaluate=true"))
            }).ToArray());
        }
コード例 #4
0
 public static Command AddProjectReference()
 {
     return(Create.Command(
                "reference",
                LocalizableStrings.AppFullName,
                Accept.OneOrMoreArguments()
                .With(name: LocalizableStrings.ProjectPathArgumentName,
                      description: LocalizableStrings.ProjectPathArgumentDescription),
                CommonOptions.HelpOption(),
                Create.Option("-f|--framework", LocalizableStrings.CmdFrameworkDescription,
                              Accept.ExactlyOneArgument()
                              .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
                              .With(name: Tools.Add.PackageReference.LocalizableStrings.CmdFramework)),
                CommonOptions.InteractiveOption()));
 }
コード例 #5
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()
 });
コード例 #6
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.InteractiveOption(),
     CommonOptions.VerbosityOption());
コード例 #7
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.InteractiveOption(),
     CommonOptions.NoRestoreOption(),
     CommonOptions.VerbosityOption());
コード例 #8
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")),
            CommonOptions.NoRestoreOption(),
            CommonOptions.InteractiveOption(),
            CommonOptions.VerbosityOption());