diff --git a/build/DependencyVersions.props b/build/DependencyVersions.props index fcf159e33..872193613 100644 --- a/build/DependencyVersions.props +++ b/build/DependencyVersions.props @@ -16,6 +16,8 @@ 1.0.0-beta1-20170209-117 1.0.3 1.0.3 + 0.1.0-alpha-74 + diff --git a/scripts/register-completions.ps1 b/scripts/register-completions.ps1 index 58023e52b..dfc701504 100644 --- a/scripts/register-completions.ps1 +++ b/scripts/register-completions.ps1 @@ -1,7 +1,7 @@ # PowerShell parameter completion shim for the dotnet CLI Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock { param($commandName, $wordToComplete, $cursorPosition) - dotnet.exe complete --position $cursorPosition "$wordToComplete" | ForEach-Object { + C:\dev\github\cli\artifacts\win10-x64\stage2\dotnet.exe complete --position $cursorPosition "$wordToComplete" | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) } } \ No newline at end of file diff --git a/src/dotnet/CompleteCommandParser.cs b/src/dotnet/CompleteCommandParser.cs deleted file mode 100644 index b4add15ea..000000000 --- a/src/dotnet/CompleteCommandParser.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation and contributors. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. - -using System; -using System.Linq; -using Microsoft.DotNet.Cli.CommandLine; - -namespace Microsoft.DotNet.Cli -{ - internal static class CompleteCommandParser - { - public static Command Complete() => - Create.Command("complete", "", - Accept.ExactlyOneArgument - .With(name: "path"), - Create.Option("--position", "", - Accept.ExactlyOneArgument - .With(name: "command"), - o => Int32.Parse(o.Arguments.Single()))); - } -} \ No newline at end of file diff --git a/src/dotnet/ForwardingApp.cs b/src/dotnet/ForwardingApp.cs index 01f26aa46..aad57a197 100644 --- a/src/dotnet/ForwardingApp.cs +++ b/src/dotnet/ForwardingApp.cs @@ -80,7 +80,7 @@ namespace Microsoft.DotNet.Cli UseShellExecute = false }; - Reporter.Verbose.WriteLine($"[Forwarding] {processInfo.FileName} {processInfo.Arguments}"); + Reporter.Output.WriteLine($"[Forwarding] {processInfo.FileName} {processInfo.Arguments}"); if (_environmentVariables != null) { diff --git a/src/dotnet/commands/dotnet-build/BuildCommandParser.cs b/src/dotnet/commands/dotnet-build/BuildCommandParser.cs index f93feb438..9e9a27c1a 100644 --- a/src/dotnet/commands/dotnet-build/BuildCommandParser.cs +++ b/src/dotnet/commands/dotnet-build/BuildCommandParser.cs @@ -8,32 +8,49 @@ namespace Microsoft.DotNet.Cli internal static class BuildCommandParser { public static Command Build() => - Create.Command("build", - ".NET Builder", - CommonOptions.HelpOption(), - Create.Option("-o|--output", - "Output directory in which to place built artifacts.", - Accept.ExactlyOneArgument - .With(name: "OUTPUT_DIR")), - Create.Option("-f|--framework", - "Target framework to build for. The target framework has to be specified in the project file.", - Accept.AnyOneOf(Suggest.TargetFrameworksFromProjectFile)), - Create.Option("-r|--runtime", - "Target runtime to build for. The default is to build a portable application.", - Accept.AnyOneOf(Suggest.RunTimesFromProjectFile)), - 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")), - Create.Option("--version-suffix", - "Defines the value for the $(VersionSuffix) property in the project", - Accept.ExactlyOneArgument - .With(name: "VERSION_SUFFIX")), - Create.Option("--no-incremental", - "Disables incremental build."), - Create.Option("--no-dependencies", - "Set this flag to ignore project-to-project references and only build the root project"), - CommonOptions.VerbosityOption()); + Create.Command( + "build", + ".NET Builder", + Accept.ZeroOrOneArgument + .ForwardAs("{0}"), + CommonOptions.HelpOption(), + Create.Option( + "-o|--output", + "Output directory in which to place built artifacts.", + Accept.ExactlyOneArgument + .With(name: "OUTPUT_DIR") + .ForwardAs("/p:OutputPath={0}")), + 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("/p:TargetFramework={0}")), + Create.Option( + "-r|--runtime", + "Target runtime to build for. The default is to build a portable application.", + Accept.AnyOneOf(Suggest.RunTimesFromProjectFile) + .ForwardAs("/p:RuntimeIdentifier={0}")), + 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("/p:Configuration={0}")), + Create.Option( + "--version-suffix", + "Defines the value for the $(VersionSuffix) property in the project", + Accept.ExactlyOneArgument + .With(name: "VERSION_SUFFIX") + .ForwardAs("/p:VersionSuffix={0}")), + Create.Option( + "--no-incremental", + "Disables incremental build."), + Create.Option( + "--no-dependencies", + "Set this flag to ignore project-to-project references and only build the root project", + Accept.NoArguments + .ForwardAs("/p:BuildProjectReferences=false")), + CommonOptions.VerbosityOption()); } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-complete/CompleteCommandParser.cs b/src/dotnet/commands/dotnet-complete/CompleteCommandParser.cs new file mode 100644 index 000000000..f8313355a --- /dev/null +++ b/src/dotnet/commands/dotnet-complete/CompleteCommandParser.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation and contributors. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. + +using System.Linq; +using Microsoft.DotNet.Cli.CommandLine; + +namespace Microsoft.DotNet.Cli +{ + internal static class CompleteCommandParser + { + public static Command Complete() => + Create.Command( + "complete", "", + Accept.ExactlyOneArgument + .With(name: "path") + .MaterializeAs(o => int.Parse(o.Arguments.Single())), + Create.Option("--position", "", + Accept.ExactlyOneArgument + .With(name: "command"))); + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-restore/Program.cs b/src/dotnet/commands/dotnet-restore/Program.cs index d24c0cd44..73c1d9794 100644 --- a/src/dotnet/commands/dotnet-restore/Program.cs +++ b/src/dotnet/commands/dotnet-restore/Program.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. +using System; using System.Collections.Generic; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Cli.Utils; @@ -21,10 +22,14 @@ namespace Microsoft.DotNet.Tools.Restore { DebugHelper.HandleDebugSwitch(ref args); - var parser = Parser.DotnetCommand["restore"]; + var parser = new Cli.CommandLine.Parser( + delimiters: Array.Empty(), + options: Parser.DotnetCommand["restore"]); var result = parser.Parse(args); + Reporter.Verbose.WriteLine(result.Diagram()); + var restore = result["restore"]; var msbuildArgs = new List diff --git a/src/dotnet/commands/dotnet-restore/RestoreCommandParser.cs b/src/dotnet/commands/dotnet-restore/RestoreCommandParser.cs index 44340ef6b..e9ed45f7a 100644 --- a/src/dotnet/commands/dotnet-restore/RestoreCommandParser.cs +++ b/src/dotnet/commands/dotnet-restore/RestoreCommandParser.cs @@ -8,9 +8,10 @@ namespace Microsoft.DotNet.Cli internal static class RestoreCommandParser { public static Command Restore() => - Create.Command("restore", + Create.Command( + "restore", ".NET dependency restorer", - Accept.OneOrMoreArguments, + Accept.ExactlyOneArgument, CommonOptions.HelpOption(), Create.Option( "-s|--source", diff --git a/src/dotnet/dotnet.csproj b/src/dotnet/dotnet.csproj index fb24f652e..c97b5fe24 100644 --- a/src/dotnet/dotnet.csproj +++ b/src/dotnet/dotnet.csproj @@ -40,7 +40,7 @@ - + diff --git a/test/dotnet.Tests/dotnet.Tests.csproj b/test/dotnet.Tests/dotnet.Tests.csproj index 825c0a095..8d940820d 100644 --- a/test/dotnet.Tests/dotnet.Tests.csproj +++ b/test/dotnet.Tests/dotnet.Tests.csproj @@ -42,6 +42,6 @@ - +