new CliCommandLine version

This commit is contained in:
Jon Sequeira 2017-03-10 17:11:19 -08:00
parent a3f536c248
commit 34d9cbf863
20 changed files with 72 additions and 70 deletions

View file

@ -16,7 +16,7 @@
<TemplateEngineTemplate2_0Version>1.0.0-beta1-20170209-117</TemplateEngineTemplate2_0Version> <TemplateEngineTemplate2_0Version>1.0.0-beta1-20170209-117</TemplateEngineTemplate2_0Version>
<PlatformAbstractionsVersion>1.0.3</PlatformAbstractionsVersion> <PlatformAbstractionsVersion>1.0.3</PlatformAbstractionsVersion>
<DependencyModelVersion>1.0.3</DependencyModelVersion> <DependencyModelVersion>1.0.3</DependencyModelVersion>
<CliCommandLineParserVersion>0.1.0-alpha-74</CliCommandLineParserVersion> <CliCommandLineParserVersion>0.1.0-alpha-84</CliCommandLineParserVersion>
</PropertyGroup> </PropertyGroup>

View file

@ -11,7 +11,7 @@ namespace Microsoft.DotNet.Cli
Create.Option( Create.Option(
"-h|--help", "-h|--help",
"Show help information", "Show help information",
Accept.NoArguments, Accept.NoArguments(),
materialize: o => o.Option.Command().HelpView()); materialize: o => o.Option.Command().HelpView());
public static Option VerbosityOption() => public static Option VerbosityOption() =>

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli
delimiters: Array.Empty<char>(), delimiters: Array.Empty<char>(),
options: Create.Command("dotnet", options: Create.Command("dotnet",
".NET Command Line Tools", ".NET Command Line Tools",
Accept.NoArguments, Accept.NoArguments(),
NewCommandParser.New(), NewCommandParser.New(),
RestoreCommandParser.Restore(), RestoreCommandParser.Restore(),
BuildCommandParser.Build(), BuildCommandParser.Build(),

View file

@ -17,43 +17,45 @@ namespace Microsoft.DotNet.Cli
Create.Command( Create.Command(
"add", "add",
".NET Add Command", ".NET Add Command",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.DefaultToCurrentDirectory(), .DefaultToCurrentDirectory(),
Create.Command( Create.Command(
"package", "package",
".NET Add Package reference Command", ".NET Add Package reference Command",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.WithSuggestionsFrom(QueryNuGet), CommonOptions.HelpOption(), .WithSuggestionsFrom(QueryNuGet), CommonOptions.HelpOption(),
Create.Option("-v|--version", Create.Option("-v|--version",
"Version for the package to be added.", "Version for the package to be added.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "VERSION") .With(name: "VERSION")
.ForwardAs(o => $"--version {o.Arguments.Single()}")), .ForwardAs(o => $"--version {o.Arguments.Single()}")),
Create.Option("-f|--framework", Create.Option("-f|--framework",
"Add reference only when targetting a specific framework", "Add reference only when targetting a specific framework",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "FRAMEWORK") .With(name: "FRAMEWORK")
.ForwardAs(o => $"--framework {o.Arguments.Single()}")), .ForwardAs(o => $"--framework {o.Arguments.Single()}")),
Create.Option("-n|--no-restore ", Create.Option("-n|--no-restore ",
"Add reference without performing restore preview and compatibility check."), "Add reference without performing restore preview and compatibility check."),
Create.Option("-s|--source", Create.Option("-s|--source",
"Use specific NuGet package sources to use during the restore.", "Use specific NuGet package sources to use during the restore.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "SOURCE") .With(name: "SOURCE")
.ForwardAs(o => $"--source {o.Arguments.Single()}")), .ForwardAs(o => $"--source {o.Arguments.Single()}")),
Create.Option("--package-directory", Create.Option("--package-directory",
"Restore the packages to this Directory .", "Restore the packages to this Directory .",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "PACKAGE_DIRECTORY") .With(name: "PACKAGE_DIRECTORY")
.ForwardAs(o => $"--package-directory {o.Arguments.Single()}"))), .ForwardAs(o => $"--package-directory {o.Arguments.Single()}"))),
Create.Command( Create.Command(
"reference", "reference",
"Command to add project to project reference", "Command to add project to project reference",
Accept.OneOrMoreArguments, CommonOptions.HelpOption(), Accept.OneOrMoreArguments(),
CommonOptions.HelpOption(),
Create.Option("-f|--framework", Create.Option("-f|--framework",
"Add reference only when targetting a specific framework", "Add reference only when targetting a specific framework",
Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile) Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile)
.With(name: "FRAMEWORK"))), CommonOptions.HelpOption()); .With(name: "FRAMEWORK"))),
CommonOptions.HelpOption());
public static IEnumerable<string> QueryNuGet(string match) public static IEnumerable<string> QueryNuGet(string match)
{ {

View file

@ -12,13 +12,13 @@ namespace Microsoft.DotNet.Cli
Create.Command( Create.Command(
"build", "build",
".NET Builder", ".NET Builder",
Accept.ZeroOrOneArgument Accept.ZeroOrOneArgument()
.Forward(), .Forward(),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option( Create.Option(
"-o|--output", "-o|--output",
"Output directory in which to place built artifacts.", "Output directory in which to place built artifacts.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "OUTPUT_DIR") .With(name: "OUTPUT_DIR")
.ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")), .ForwardAs(o => $"/p:OutputPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
@ -34,14 +34,14 @@ namespace Microsoft.DotNet.Cli
Create.Option( Create.Option(
"-c|--configuration", "-c|--configuration",
"Configuration to use for building the project. Default for most projects is \"Debug\".", "Configuration to use for building the project. Default for most projects is \"Debug\".",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", "RELEASE") .WithSuggestionsFrom("DEBUG", "RELEASE")
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")), .ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--version-suffix", "--version-suffix",
"Defines the value for the $(VersionSuffix) property in the project", "Defines the value for the $(VersionSuffix) property in the project",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "VERSION_SUFFIX") .With(name: "VERSION_SUFFIX")
.ForwardAs(o => $"/p:VersionSuffix={o.Arguments.Single()}")), .ForwardAs(o => $"/p:VersionSuffix={o.Arguments.Single()}")),
Create.Option( Create.Option(
@ -50,7 +50,7 @@ namespace Microsoft.DotNet.Cli
Create.Option( Create.Option(
"--no-dependencies", "--no-dependencies",
"Set this flag to ignore project-to-project references and only build the root project", "Set this flag to ignore project-to-project references and only build the root project",
Accept.NoArguments Accept.NoArguments()
.ForwardAs("/p:BuildProjectReferences=false")), .ForwardAs("/p:BuildProjectReferences=false")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }

View file

@ -12,15 +12,15 @@ namespace Microsoft.DotNet.Cli
".NET Clean Command", ".NET Clean Command",
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option("-o|--output", "Directory in which the build outputs have been placed.", Create.Option("-o|--output", "Directory in which the build outputs have been placed.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "OUTPUT_DIR")), .With(name: "OUTPUT_DIR")),
Create.Option("-f|--framework", "Clean a specific framework.", Create.Option("-f|--framework", "Clean a specific framework.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "FRAMEWORK") .With(name: "FRAMEWORK")
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())), .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())),
Create.Option("-c|--configuration", Create.Option("-c|--configuration",
"Clean a specific configuration.", "Clean a specific configuration.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", "RELEASE"))); .WithSuggestionsFrom("DEBUG", "RELEASE")));
} }

View file

@ -11,10 +11,10 @@ namespace Microsoft.DotNet.Cli
public static Command Complete() => public static Command Complete() =>
Create.Command( Create.Command(
"complete", "", "complete", "",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "path"), .With(name: "path"),
Create.Option("--position", "", Create.Option("--position", "",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "command") .With(name: "command")
.MaterializeAs(o => int.Parse(o.Arguments.Single())))); .MaterializeAs(o => int.Parse(o.Arguments.Single()))));
} }

View file

@ -10,14 +10,14 @@ namespace Microsoft.DotNet.Cli
public static Command List() => public static Command List() =>
Create.Command("list", Create.Command("list",
".NET List Command", ".NET List Command",
Accept.ZeroOrOneArgument Accept.ZeroOrOneArgument()
.With(name: "PROJECT", .With(name: "PROJECT",
description: description:
"The project file to operate on. If a file is not specified, the command will search the current directory for one.") "The project file to operate on. If a file is not specified, the command will search the current directory for one.")
.DefaultToCurrentDirectory(), .DefaultToCurrentDirectory(),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Command("reference", "Command to list project to project references", Create.Command("reference", "Command to list project to project references",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "PROJECT", .With(name: "PROJECT",
description: description:
"The project file to operate on. If a file is not specified, the command will search the current directory for one."), "The project file to operate on. If a file is not specified, the command will search the current directory for one."),

View file

@ -11,7 +11,7 @@ namespace Microsoft.DotNet.Cli
Create.Command("new", Create.Command("new",
"Initialize .NET projects.", "Initialize .NET projects.",
Accept Accept
.ExactlyOneArgument .ExactlyOneArgument()
.WithSuggestionsFrom( .WithSuggestionsFrom(
"console", "console",
"classlib", "classlib",

View file

@ -15,11 +15,11 @@ namespace Microsoft.DotNet.Cli
"Show version information"), "Show version information"),
Create.Option("-v|--verbosity", Create.Option("-v|--verbosity",
"The verbosity of logging to use. Allowed values: Debug, Verbose, Information, Minimal, Warning, Error.", "The verbosity of logging to use. Allowed values: Debug, Verbose, Information, Minimal, Warning, Error.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "verbosity")), .With(name: "verbosity")),
Create.Command("delete", Create.Command("delete",
"Deletes a package from the server.", "Deletes a package from the server.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "root", .With(name: "root",
description: "The Package Id and version."), description: "The Package Id and version."),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
@ -27,13 +27,13 @@ namespace Microsoft.DotNet.Cli
"Forces the application to run using an invariant, English-based culture."), "Forces the application to run using an invariant, English-based culture."),
Create.Option("-s|--source", Create.Option("-s|--source",
"Specifies the server URL", "Specifies the server URL",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "source")), .With(name: "source")),
Create.Option("--non-interactive", Create.Option("--non-interactive",
"Do not prompt for user input or confirmations."), "Do not prompt for user input or confirmations."),
Create.Option("-k|--api-key", Create.Option("-k|--api-key",
"The API key for the server.", "The API key for the server.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "apiKey"))), .With(name: "apiKey"))),
Create.Command("locals", Create.Command("locals",
"Clears or lists local NuGet resources such as http requests cache, packages cache or machine-wide global packages folder.", "Clears or lists local NuGet resources such as http requests cache, packages cache or machine-wide global packages folder.",
@ -54,21 +54,21 @@ namespace Microsoft.DotNet.Cli
"Forces the application to run using an invariant, English-based culture."), "Forces the application to run using an invariant, English-based culture."),
Create.Option("-s|--source", Create.Option("-s|--source",
"Specifies the server URL", "Specifies the server URL",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "source")), .With(name: "source")),
Create.Option("-ss|--symbol-source", Create.Option("-ss|--symbol-source",
"Specifies the symbol server URL. If not specified, nuget.smbsrc.net is used when pushing to nuget.org.", "Specifies the symbol server URL. If not specified, nuget.smbsrc.net is used when pushing to nuget.org.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "source")), .With(name: "source")),
Create.Option("-t|--timeout", Create.Option("-t|--timeout",
"Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).", "Specifies the timeout for pushing to a server in seconds. Defaults to 300 seconds (5 minutes).",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "timeout")), .With(name: "timeout")),
Create.Option("-k|--api-key", "The API key for the server.", Create.Option("-k|--api-key", "The API key for the server.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "apiKey")), .With(name: "apiKey")),
Create.Option("-sk|--symbol-api-key", "The API key for the symbol server.", Create.Option("-sk|--symbol-api-key", "The API key for the symbol server.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "apiKey")), .With(name: "apiKey")),
Create.Option("-d|--disable-buffering", Create.Option("-d|--disable-buffering",
"Disable buffering when pushing to an HTTP(S) server to decrease memory usage."), "Disable buffering when pushing to an HTTP(S) server to decrease memory usage."),

View file

@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Cli
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option("-o|--output", Create.Option("-o|--output",
"Directory in which to place built packages.", "Directory in which to place built packages.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "OUTPUT_DIR")), .With(name: "OUTPUT_DIR")),
Create.Option("--no-build", Create.Option("--no-build",
"Skip building the project prior to packing. By default, the project will be built."), "Skip building the project prior to packing. By default, the project will be built."),
@ -23,13 +23,13 @@ namespace Microsoft.DotNet.Cli
"Include PDBs and source files. Source files go into the src folder in the resulting nuget package"), "Include PDBs and source files. Source files go into the src folder in the resulting nuget package"),
Create.Option("-c|--configuration", Create.Option("-c|--configuration",
"Configuration to use for building the project. Default for most projects is \"Debug\".", "Configuration to use for building the project. Default for most projects is \"Debug\".",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", .WithSuggestionsFrom("DEBUG",
"RELEASE")), "RELEASE")),
Create.Option("--version-suffix", Create.Option("--version-suffix",
"Defines the value for the $(VersionSuffix) property in the project.", "Defines the value for the $(VersionSuffix) property in the project.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "VERSION_SUFFIX")), .With(name: "VERSION_SUFFIX")),
Create.Option("-s|--serviceable", Create.Option("-s|--serviceable",
"Set the serviceable flag in the package. For more information, please see https://aka.ms/nupkgservicing."), "Set the serviceable flag in the package. For more information, please see https://aka.ms/nupkgservicing."),

View file

@ -12,36 +12,36 @@ namespace Microsoft.DotNet.Cli
Create.Command( Create.Command(
"publish", "publish",
".NET Publisher", ".NET Publisher",
Accept.ZeroOrMoreArguments, Accept.ZeroOrMoreArguments(),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option("-f|--framework", Create.Option("-f|--framework",
"Target framework to publish for. The target framework has to be specified in the project file.", "Target framework to publish for. The target framework has to be specified in the project file.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile())
.With(name: "FRAMEWORK") .With(name: "FRAMEWORK")
.ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}")), .ForwardAs(o => $"/p:TargetFramework={o.Arguments.Single()}")),
Create.Option("-r|--runtime", 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.", "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 Accept.ExactlyOneArgument()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: "RUNTIME_IDENTIFIER") .With(name: "RUNTIME_IDENTIFIER")
.ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")), .ForwardAs(o => $"/p:RuntimeIdentifier={o.Arguments.Single()}")),
Create.Option("-o|--output", Create.Option("-o|--output",
"Output directory in which to place the published artifacts.", "Output directory in which to place the published artifacts.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "OUTPUT_DIR") .With(name: "OUTPUT_DIR")
.ForwardAs(o => $"/p:PublishDir={o.Arguments.Single()}")), .ForwardAs(o => $"/p:PublishDir={o.Arguments.Single()}")),
Create.Option("-c|--configuration", "Configuration to use for building the project. Default for most projects is \"Debug\".", Create.Option("-c|--configuration", "Configuration to use for building the project. Default for most projects is \"Debug\".",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", "RELEASE") .WithSuggestionsFrom("DEBUG", "RELEASE")
.ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")), .ForwardAs(o => $"/p:Configuration={o.Arguments.Single()}")),
Create.Option("--version-suffix", "Defines the value for the $(VersionSuffix) property in the project.", Create.Option("--version-suffix", "Defines the value for the $(VersionSuffix) property in the project.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "VERSION_SUFFIX") .With(name: "VERSION_SUFFIX")
.ForwardAs(o => $"/p:VersionSuffix={o.Arguments.Single()}")), .ForwardAs(o => $"/p:VersionSuffix={o.Arguments.Single()}")),
Create.Option("--filter", "The XML file that contains the list of packages to be excluded from publish step.", Create.Option("--filter", "The XML file that contains the list of packages to be excluded from publish step.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "PROFILE_XML") .With(name: "PROFILE_XML")
.ForwardAs(o => $"/p:FilterProjectFiles={o.Arguments.Single()}")), .ForwardAs(o => $"/p:FilterProjectFiles={o.Arguments.Single()}")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());

View file

@ -10,7 +10,7 @@ namespace Microsoft.DotNet.Cli
public static Command Remove() => public static Command Remove() =>
Create.Command("remove", Create.Command("remove",
".NET Remove Command", ".NET Remove Command",
Accept.ZeroOrOneArgument Accept.ZeroOrOneArgument()
.With(name: "PROJECT") .With(name: "PROJECT")
.DefaultToCurrentDirectory(), .DefaultToCurrentDirectory(),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
@ -23,7 +23,7 @@ namespace Microsoft.DotNet.Cli
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option("-f|--framework", Create.Option("-f|--framework",
"Remove reference only when targetting a specific framework", "Remove reference only when targetting a specific framework",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "FRAMEWORK")))); .With(name: "FRAMEWORK"))));
} }
} }

View file

@ -12,52 +12,52 @@ namespace Microsoft.DotNet.Cli
Create.Command( Create.Command(
"restore", "restore",
".NET dependency restorer", ".NET dependency restorer",
Accept.ZeroOrMoreArguments, Accept.ZeroOrMoreArguments(),
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option( Create.Option(
"-s|--source", "-s|--source",
"Specifies a NuGet package source to use during the restore.", "Specifies a NuGet package source to use during the restore.",
Accept.OneOrMoreArguments Accept.OneOrMoreArguments()
.With(name: "SOURCE") .With(name: "SOURCE")
.ForwardAs(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")), .ForwardAs(o => $"/p:RestoreSources={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"-r|--runtime", "-r|--runtime",
"Target runtime to restore packages for.", "Target runtime to restore packages for.",
Accept.OneOrMoreArguments Accept.OneOrMoreArguments()
.WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile()) .WithSuggestionsFrom(_ => Suggest.RunTimesFromProjectFile())
.With(name: "RUNTIME_IDENTIFIER") .With(name: "RUNTIME_IDENTIFIER")
.ForwardAs(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")), .ForwardAs(o => $"/p:RuntimeIdentifiers={string.Join("%3B", o.Arguments)}")),
Create.Option( Create.Option(
"--packages", "--packages",
"Directory to install packages in.", "Directory to install packages in.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "PACKAGES_DIRECTORY") .With(name: "PACKAGES_DIRECTORY")
.ForwardAs(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")), .ForwardAs(o => $"/p:RestorePackagesPath={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--disable-parallel", "--disable-parallel",
"Disables restoring multiple projects in parallel.", "Disables restoring multiple projects in parallel.",
Accept.NoArguments Accept.NoArguments()
.ForwardAs("/p:RestoreDisableParallel=true")), .ForwardAs("/p:RestoreDisableParallel=true")),
Create.Option( Create.Option(
"--configfile", "--configfile",
"The NuGet configuration file to use.", "The NuGet configuration file to use.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "FILE") .With(name: "FILE")
.ForwardAs(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")), .ForwardAs(o => $"/p:RestoreConfigFile={o.Arguments.Single()}")),
Create.Option( Create.Option(
"--no-cache", "--no-cache",
"Do not cache packages and http requests.", "Do not cache packages and http requests.",
Accept.NoArguments Accept.NoArguments()
.ForwardAs("/p:RestoreNoCache=true")), .ForwardAs("/p:RestoreNoCache=true")),
Create.Option( Create.Option(
"--ignore-failed-sources", "--ignore-failed-sources",
"Treat package source failures as warnings.", "Treat package source failures as warnings.",
Accept.NoArguments Accept.NoArguments()
.ForwardAs("/p:RestoreIgnoreFailedSources=true")), .ForwardAs("/p:RestoreIgnoreFailedSources=true")),
Create.Option( Create.Option(
"--no-dependencies", "--no-dependencies",
"Set this flag to ignore project to project references and only restore the root project", "Set this flag to ignore project to project references and only restore the root project",
Accept.NoArguments Accept.NoArguments()
.ForwardAs("/p:RestoreRecursive=false")), .ForwardAs("/p:RestoreRecursive=false")),
CommonOptions.VerbosityOption()); CommonOptions.VerbosityOption());
} }

View file

@ -13,13 +13,13 @@ namespace Microsoft.DotNet.Cli
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Option("-c|--configuration", Create.Option("-c|--configuration",
@"Configuration to use for building the project. Default for most projects is ""Debug"".", @"Configuration to use for building the project. Default for most projects is ""Debug"".",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.WithSuggestionsFrom("DEBUG", "RELEASE")), .WithSuggestionsFrom("DEBUG", "RELEASE")),
Create.Option("-f|--framework", Create.Option("-f|--framework",
"Build and run the app using the specified framework. The framework has to be specified in the project file.", "Build and run the app using the specified framework. The framework has to be specified in the project file.",
Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile)), Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile)),
Create.Option("-p|--project", Create.Option("-p|--project",
"The path to the project file to run (defaults to the current directory if there is only one project).", "The path to the project file to run (defaults to the current directory if there is only one project).",
Accept.ZeroOrOneArgument)); Accept.ZeroOrOneArgument()));
} }
} }

View file

@ -13,12 +13,12 @@ namespace Microsoft.DotNet.Cli
CommonOptions.HelpOption(), CommonOptions.HelpOption(),
Create.Command("add", Create.Command("add",
".NET Add project(s) to a solution file Command", ".NET Add project(s) to a solution file Command",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "SLN_FILE"), .With(name: "SLN_FILE"),
CommonOptions.HelpOption()), CommonOptions.HelpOption()),
Create.Command("list", Create.Command("list",
"List all projects in the solution.", "List all projects in the solution.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "SLN_FILE"), .With(name: "SLN_FILE"),
CommonOptions.HelpOption()), CommonOptions.HelpOption()),
Create.Command("remove", Create.Command("remove",

View file

@ -12,7 +12,7 @@ namespace Microsoft.DotNet.Cli
"Show help information"), "Show help information"),
Create.Option("-s|--settings", Create.Option("-s|--settings",
"Settings to use when running tests.", "Settings to use when running tests.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "SETTINGS_FILE")), .With(name: "SETTINGS_FILE")),
Create.Option("-t|--list-tests", Create.Option("-t|--list-tests",
"Lists discovered tests"), "Lists discovered tests"),
@ -23,16 +23,16 @@ namespace Microsoft.DotNet.Cli
Run a test with the specified full name: --filter ""FullyQualifiedName=Namespace.ClassName.MethodName"" Run a test with the specified full name: --filter ""FullyQualifiedName=Namespace.ClassName.MethodName""
Run tests that contain the specified name: --filter ""FullyQualifiedName~Namespace.Class"" Run tests that contain the specified name: --filter ""FullyQualifiedName~Namespace.Class""
More info on filtering support: https://aka.ms/vstest-filtering", More info on filtering support: https://aka.ms/vstest-filtering",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "EXPRESSION")), .With(name: "EXPRESSION")),
Create.Option("-a|--test-adapter-path", Create.Option("-a|--test-adapter-path",
"Use custom adapters from the given path in the test run.\r\n Example: --test-adapter-path <PATH_TO_ADAPTER>"), "Use custom adapters from the given path in the test run.\r\n Example: --test-adapter-path <PATH_TO_ADAPTER>"),
Create.Option("-l|--logger", Create.Option("-l|--logger",
"Specify a logger for test results.\r\n Example: --logger \"trx[;LogFileName=<Defaults to unique file name>]\"", "Specify a logger for test results.\r\n Example: --logger \"trx[;LogFileName=<Defaults to unique file name>]\"",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "LoggerUri/FriendlyName")), .With(name: "LoggerUri/FriendlyName")),
Create.Option("-c|--configuration", "Configuration to use for building the project. Default for most projects is \"Debug\".", Create.Option("-c|--configuration", "Configuration to use for building the project. Default for most projects is \"Debug\".",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "CONFIGURATION") .With(name: "CONFIGURATION")
.WithSuggestionsFrom("DEBUG", "RELEASE")), .WithSuggestionsFrom("DEBUG", "RELEASE")),
Create.Option("-f|--framework", Create.Option("-f|--framework",
@ -41,11 +41,11 @@ namespace Microsoft.DotNet.Cli
.With(name: "FRAMEWORK")), .With(name: "FRAMEWORK")),
Create.Option("-o|--output", Create.Option("-o|--output",
"Directory in which to find the binaries to be run", "Directory in which to find the binaries to be run",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "OUTPUT_DIR")), .With(name: "OUTPUT_DIR")),
Create.Option("-d|--diag", Create.Option("-d|--diag",
"Enable verbose logs for test platform.\r\n Logs are written to the provided file.", "Enable verbose logs for test platform.\r\n Logs are written to the provided file.",
Accept.ExactlyOneArgument Accept.ExactlyOneArgument()
.With(name: "PATH_TO_FILE")), .With(name: "PATH_TO_FILE")),
Create.Option("--no-build", Create.Option("--no-build",
"Do not build project before testing."), "Do not build project before testing."),

View file

@ -40,7 +40,7 @@
<PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" /> <PackageReference Include="Microsoft.Win32.Registry" Version="4.3.0" />
<PackageReference Include="Microsoft.Build" Version="$(CLI_MSBuild_Version)" /> <PackageReference Include="Microsoft.Build" Version="$(CLI_MSBuild_Version)" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" /> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-80" /> <PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-84" />
<PackageReference Include="Microsoft.TemplateEngine.Abstractions" Version="$(TemplateEngineVersion)" /> <PackageReference Include="Microsoft.TemplateEngine.Abstractions" Version="$(TemplateEngineVersion)" />
<PackageReference Include="Microsoft.TemplateEngine.Cli" Version="$(TemplateEngineVersion)" /> <PackageReference Include="Microsoft.TemplateEngine.Cli" Version="$(TemplateEngineVersion)" />
<PackageReference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" Version="$(TemplateEngineVersion)" /> <PackageReference Include="Microsoft.TemplateEngine.Orchestrator.RunnableProjects" Version="$(TemplateEngineVersion)" />

View file

@ -18,10 +18,10 @@ namespace Microsoft.DotNet.Tests.ParserTests
{ {
var command = Command("the-command", "", var command = Command("the-command", "",
Option("-o|--one", "", Option("-o|--one", "",
ZeroOrOneArgument ZeroOrOneArgument()
.ForwardAs(o => $"/i:{o.Arguments.Single()}")), .ForwardAs(o => $"/i:{o.Arguments.Single()}")),
Option("-t|--two", "", Option("-t|--two", "",
NoArguments NoArguments()
.ForwardAs("/s:true"))); .ForwardAs("/s:true")));
var result = command.Parse("the-command -t -o 123"); var result = command.Parse("the-command -t -o 123");
@ -37,7 +37,7 @@ namespace Microsoft.DotNet.Tests.ParserTests
{ {
var command = Command("the-command", "", var command = Command("the-command", "",
Option("-x", "", Option("-x", "",
ZeroOrMoreArguments ZeroOrMoreArguments()
.ForwardAs(o => $"/x:{string.Join("&", o.Arguments)}"))); .ForwardAs(o => $"/x:{string.Join("&", o.Arguments)}")));
var result = command.Parse("the-command -x one -x two"); var result = command.Parse("the-command -x one -x two");
@ -53,7 +53,7 @@ namespace Microsoft.DotNet.Tests.ParserTests
{ {
var command = Command("the-command", "", var command = Command("the-command", "",
Option("-x", "", Option("-x", "",
ZeroOrMoreArguments ZeroOrMoreArguments()
.Forward())); .Forward()));
var result = command.Parse("the-command -x one"); var result = command.Parse("the-command -x one");

View file

@ -42,6 +42,6 @@
<PackageReference Include="xunit" Version="2.2.0-beta4-build3444" /> <PackageReference Include="xunit" Version="2.2.0-beta4-build3444" />
<PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" /> <PackageReference Include="xunit.netcore.extensions" Version="1.0.0-prerelease-00206" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" /> <PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="$(PlatformAbstractionsVersion)" />
<PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-80" /> <PackageReference Include="Microsoft.DotNet.Cli.CommandLine" Version="0.1.0-alpha-84" />
</ItemGroup> </ItemGroup>
</Project> </Project>