TFM, RID, Config as CommonOptions
This commit is contained in:
parent
30e856a365
commit
3ebdf2909d
3 changed files with 34 additions and 35 deletions
|
@ -17,7 +17,7 @@ namespace Microsoft.DotNet.Cli
|
|||
public static Option VerbosityOption() =>
|
||||
Create.Option(
|
||||
"-v|--verbosity",
|
||||
"Set the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]",
|
||||
"Set the verbosity level of the command. Allowed values are q[uiet],<EFBFBD>m[inimal],<2C>n[ormal],<2C>d[etailed], and<6E>diag[nostic]",
|
||||
Accept.AnyOneOf(
|
||||
"q", "quiet",
|
||||
"m", "minimal",
|
||||
|
@ -25,6 +25,33 @@ namespace Microsoft.DotNet.Cli
|
|||
"d", "detailed",
|
||||
"diag", "diagnostic")
|
||||
.ForwardAs(o => $"/verbosity:{o.Arguments.Single()}"));
|
||||
|
||||
public static Option FrameworkOption() =>
|
||||
Create.Option(
|
||||
"-f|--framework",
|
||||
"Target framework to publish for. The target framework has to be specified in the project file.",
|
||||
Accept.ExactlyOneArgument
|
||||
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
|
||||
.With(name: "FRAMEWORK")
|
||||
.ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}"));
|
||||
|
||||
public static Option RuntimeOption() =>
|
||||
Create.Option(
|
||||
"-r|--runtime",
|
||||
"Publish the project for a given runtime. This is used when creating self-contained deployment. Default is to publish a framework-dependent app.",
|
||||
Accept.ExactlyOneArgument
|
||||
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
|
||||
.With(name: "RUNTIME_IDENTIFIER")
|
||||
.ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}"));
|
||||
|
||||
public static Option ConfigurationOption() =>
|
||||
Create.Option(
|
||||
"-c|--configuration",
|
||||
"Configuration to use for building the project. Default for most projects is \"Debug\".",
|
||||
Accept.ExactlyOneArgument
|
||||
.With(name: "CONFIGURATION")
|
||||
.WithSuggestionsFrom("DEBUG", "RELEASE")
|
||||
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")),
|
||||
|
||||
public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) =>
|
||||
rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));
|
||||
|
|
|
@ -20,23 +20,9 @@ namespace Microsoft.DotNet.Cli
|
|||
Accept.ExactlyOneArgument
|
||||
.With(name: "OUTPUT_DIR")
|
||||
.ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")),
|
||||
Create.Option(
|
||||
"-f|--framework",
|
||||
"Target framework to build for. The target framework has to be specified in the project file.",
|
||||
Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile)
|
||||
.ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}")),
|
||||
Create.Option(
|
||||
"-r|--runtime",
|
||||
"Target runtime to build for. The default is to build a portable application.",
|
||||
Accept.AnyOneOf(Suggest.RunTimesFromProjectFile)
|
||||
.ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")),
|
||||
Create.Option(
|
||||
"-c|--configuration",
|
||||
"Configuration to use for building the project. Default for most projects is \"Debug\".",
|
||||
Accept.ExactlyOneArgument
|
||||
.With(name: "CONFIGURATION")
|
||||
.WithSuggestionsFrom("DEBUG", "RELEASE")
|
||||
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")),
|
||||
CommonOptions.FrameworkOption(),
|
||||
CommonOptions.RuntimeOption(),
|
||||
CommonOptions.ConfigurationOption(),
|
||||
Create.Option(
|
||||
"--version-suffix",
|
||||
"Defines the value for the $(VersionSuffix) property in the project",
|
||||
|
|
|
@ -14,28 +14,14 @@ namespace Microsoft.DotNet.Cli
|
|||
".NET Publisher",
|
||||
Accept.ZeroOrMoreArguments,
|
||||
CommonOptions.HelpOption(),
|
||||
Create.Option("-f|--framework",
|
||||
"Target framework to publish for. The target framework has to be specified in the project file.",
|
||||
Accept.ExactlyOneArgument
|
||||
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
|
||||
.With(name: "FRAMEWORK")
|
||||
.ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}")),
|
||||
Create.Option("-r|--runtime",
|
||||
"Publish the project for a given runtime. This is used when creating self-contained deployment. Default is to publish a framework-dependent app.",
|
||||
Accept.ExactlyOneArgument
|
||||
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
|
||||
.With(name: "RUNTIME_IDENTIFIER")
|
||||
.ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")),
|
||||
CommonOptions.FrameworkOption(),
|
||||
CommonOptions.RuntimeOption(),
|
||||
Create.Option("-o|--output",
|
||||
"Output directory in which to place the published artifacts.",
|
||||
Accept.ExactlyOneArgument
|
||||
.With(name: "OUTPUT_DIR")
|
||||
.ForwardAs(o => $"/p:PublishDir={o.Arguments.Single()}")),
|
||||
Create.Option("-c|--configuration", "Configuration to use for building the project. Default for most projects is \"Debug\".",
|
||||
Accept.ExactlyOneArgument
|
||||
.With(name: "CONFIGURATION")
|
||||
.WithSuggestionsFrom("DEBUG", "RELEASE")
|
||||
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")),
|
||||
CommonOptions.ConfigurationOption(),
|
||||
Create.Option("--version-suffix", "Defines the value for the $(VersionSuffix) property in the project.",
|
||||
Accept.ExactlyOneArgument
|
||||
.With(name: "VERSION_SUFFIX")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue