diff --git a/src/dotnet/CommonLocalizableStrings.cs b/src/dotnet/CommonLocalizableStrings.cs index 191509ab4..d19b462d5 100644 --- a/src/dotnet/CommonLocalizableStrings.cs +++ b/src/dotnet/CommonLocalizableStrings.cs @@ -158,8 +158,8 @@ namespace Microsoft.DotNet.Tools /// sln public const string ArgumentsProjectDescription = "The project file to operate on. If a file is not specified, the command will search the current directory for one."; public const string ArgumentsSolutionDescription = "Solution file to operate on. If not specified, the command will search the current directory for one."; - public const string CmdSlnFile = ""; - public const string CmdProjectFile = ""; + public const string CmdSlnFile = "SLN_FILE"; + public const string CmdProjectFile = "PROJECT"; /// commands public const string CmdFramework = "FRAMEWORK"; diff --git a/src/dotnet/commands/dotnet-add/AddCommandParser.cs b/src/dotnet/commands/dotnet-add/AddCommandParser.cs index ed816ace3..39093759a 100644 --- a/src/dotnet/commands/dotnet-add/AddCommandParser.cs +++ b/src/dotnet/commands/dotnet-add/AddCommandParser.cs @@ -2,13 +2,10 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; -using System.Collections.Generic; using System.Linq; -using System.Net.Http; -using System.Threading; using Microsoft.DotNet.Cli.CommandLine; -using Newtonsoft.Json.Linq; -using LocalizableStrings = Microsoft.DotNet.Tools.Add.PackageReference.LocalizableStrings; +using Microsoft.DotNet.Tools; +using LocalizableStrings = Microsoft.DotNet.Tools.Add.LocalizableStrings; namespace Microsoft.DotNet.Cli { @@ -17,81 +14,12 @@ namespace Microsoft.DotNet.Cli public static Command Add() => Create.Command( "add", - ".NET Add Command", + LocalizableStrings.NetAddCommand, Accept.ExactlyOneArgument() .DefaultToCurrentDirectory() - .With(name: "PROJECT", - description: "The project file to operate on. If a file is not specified, the command will search the current directory for one."), - Create.Command( - "package", - ".NET Add Package reference Command", - Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageReference) - .WithSuggestionsFrom(QueryNuGet) - .With(name: "PACKAGE_NAME", - description: "Package references to add"), - CommonOptions.HelpOption(), - Create.Option("-v|--version", - "Version for the package to be added.", - Accept.ExactlyOneArgument() - .With(name: "VERSION") - .ForwardAsSingle(o => $"--version {o.Arguments.Single()}")), - Create.Option("-f|--framework", - LocalizableStrings.CmdFrameworkDescription, - Accept.ExactlyOneArgument() - .With(name: "FRAMEWORK") - .ForwardAsSingle(o => $"--framework {o.Arguments.Single()}")), - Create.Option("-n|--no-restore ", - "Add reference without performing restore preview and compatibility check."), - Create.Option("-s|--source", - "Use specific NuGet package sources to use during the restore.", - Accept.ExactlyOneArgument() - .With(name: "SOURCE") - .ForwardAsSingle(o => $"--source {o.Arguments.Single()}")), - Create.Option("--package-directory", - "Restore the packages to this Directory .", - Accept.ExactlyOneArgument() - .With(name: "PACKAGE_DIRECTORY") - .ForwardAsSingle(o => $"--package-directory {o.Arguments.Single()}"))), - Create.Command( - "reference", - Tools.Add.ProjectToProjectReference.LocalizableStrings.AppFullName, - Accept.OneOrMoreArguments() - .With(name: "args", - description: Tools.Add.ProjectToProjectReference.LocalizableStrings.AppHelpText), - CommonOptions.HelpOption(), - Create.Option("-f|--framework", - LocalizableStrings.CmdFrameworkDescription, - Accept - .ExactlyOneArgument() - .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile()) - .With(name: "FRAMEWORK"))), + .With(name: CommonLocalizableStrings.CmdProjectFile, + description: CommonLocalizableStrings.ArgumentsProjectDescription), AddPackageParser.AddPackage(), + AddProjectToProjectReferenceParser.AddProjectReference(), CommonOptions.HelpOption()); - - public static IEnumerable QueryNuGet(string match) - { - var httpClient = new HttpClient(); - - string result; - - try - { - var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10)); - var response = httpClient.GetAsync($"https://api-v2v3search-0.nuget.org/query?q={match}&skip=0&take=100&prerelease=true", cancellation.Token) - .Result; - - result = response.Content.ReadAsStringAsync().Result; - } - catch (Exception) - { - yield break; - } - - var json = JObject.Parse(result); - - foreach (var id in json["data"]) - { - yield return id["id"].Value(); - } - } } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs b/src/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs new file mode 100644 index 000000000..70687e8d2 --- /dev/null +++ b/src/dotnet/commands/dotnet-add/dotnet-add-package/AddPackageParser.cs @@ -0,0 +1,78 @@ +// 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 System.Linq; +using System.Net.Http; +using System.Threading; +using Microsoft.DotNet.Cli.CommandLine; +using Newtonsoft.Json.Linq; +using LocalizableStrings = Microsoft.DotNet.Tools.Add.PackageReference.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class AddPackageParser + { + public static Command AddPackage() + { + return Create.Command( + "package", + LocalizableStrings.AppFullName, + Accept.ExactlyOneArgument(errorMessage: o => LocalizableStrings.SpecifyExactlyOnePackageReference) + .WithSuggestionsFrom(QueryNuGet) + .With(name: LocalizableStrings.CmdPackage, + description: LocalizableStrings.CmdPackageDescription), + CommonOptions.HelpOption(), + Create.Option("-v|--version", + LocalizableStrings.CmdVersionDescription, + Accept.ExactlyOneArgument() + .With(name: LocalizableStrings.CmdVersion) + .ForwardAsSingle(o => $"--version {o.Arguments.Single()}")), + Create.Option("-f|--framework", + LocalizableStrings.CmdFrameworkDescription, + Accept.ExactlyOneArgument() + .With(name: LocalizableStrings.CmdFramework) + .ForwardAsSingle(o => $"--framework {o.Arguments.Single()}")), + Create.Option("-n|--no-restore ", + LocalizableStrings.CmdNoRestoreDescription), + Create.Option("-s|--source", + LocalizableStrings.CmdSourceDescription, + Accept.ExactlyOneArgument() + .With(name: LocalizableStrings.CmdSource) + .ForwardAsSingle(o => $"--source {o.Arguments.Single()}")), + Create.Option("--package-directory", + LocalizableStrings.CmdPackageDirectoryDescription, + Accept.ExactlyOneArgument() + .With(name: LocalizableStrings.CmdPackageDirectory) + .ForwardAsSingle(o => $"--package-directory {o.Arguments.Single()}"))); + } + + public static IEnumerable QueryNuGet(string match) + { + var httpClient = new HttpClient(); + + string result; + + try + { + var cancellation = new CancellationTokenSource(TimeSpan.FromSeconds(10)); + var response = httpClient.GetAsync($"https://api-v2v3search-0.nuget.org/query?q={match}&skip=0&take=100&prerelease=true", cancellation.Token) + .Result; + + result = response.Content.ReadAsStringAsync().Result; + } + catch (Exception) + { + yield break; + } + + var json = JObject.Parse(result); + + foreach (var id in json["data"]) + { + yield return id["id"].Value(); + } + } + } +} diff --git a/src/dotnet/commands/dotnet-add/dotnet-add-reference/AddProjectToProjectReferenceParser.cs b/src/dotnet/commands/dotnet-add/dotnet-add-reference/AddProjectToProjectReferenceParser.cs new file mode 100644 index 000000000..417e2f97c --- /dev/null +++ b/src/dotnet/commands/dotnet-add/dotnet-add-reference/AddProjectToProjectReferenceParser.cs @@ -0,0 +1,26 @@ +// 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 Microsoft.DotNet.Cli.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.Add.ProjectToProjectReference.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class AddProjectToProjectReferenceParser + { + public static Command AddProjectReference() + { + return Create.Command( + "reference", + LocalizableStrings.AppFullName, + Accept.OneOrMoreArguments() + .With(name: "args", + description: LocalizableStrings.AppHelpText), + CommonOptions.HelpOption(), + Create.Option("-f|--framework", LocalizableStrings.CmdFrameworkDescription, + Accept.ExactlyOneArgument() + .WithSuggestionsFrom(_ => Suggest.TargetFrameworksFromProjectFile()) + .With(name: Tools.Add.PackageReference.LocalizableStrings.CmdFramework))); + } + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-build/BuildCommandParser.cs b/src/dotnet/commands/dotnet-build/BuildCommandParser.cs index e75d179e6..eaa00740f 100644 --- a/src/dotnet/commands/dotnet-build/BuildCommandParser.cs +++ b/src/dotnet/commands/dotnet-build/BuildCommandParser.cs @@ -3,6 +3,7 @@ using System.Linq; using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Tools; using LocalizableStrings = Microsoft.DotNet.Tools.Build.LocalizableStrings; namespace Microsoft.DotNet.Cli @@ -14,7 +15,7 @@ namespace Microsoft.DotNet.Cli "build", LocalizableStrings.AppFullName, Accept.ZeroOrMoreArguments() - .With(name: "PROJECT", + .With(name: CommonLocalizableStrings.CmdProjectFile, description: "The MSBuild project file to build. If a project file is not specified, MSBuild searches the current working directory for a file that has a file extension that ends in `proj` and uses that file."), CommonOptions.HelpOption(), diff --git a/src/dotnet/commands/dotnet-list/ListCommandParser.cs b/src/dotnet/commands/dotnet-list/ListCommandParser.cs index 867c5c3e0..1fee43e0f 100644 --- a/src/dotnet/commands/dotnet-list/ListCommandParser.cs +++ b/src/dotnet/commands/dotnet-list/ListCommandParser.cs @@ -2,7 +2,8 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Microsoft.DotNet.Cli.CommandLine; -using LocalizableStrings = Microsoft.DotNet.Tools.List.ProjectToProjectReferences.LocalizableStrings; +using Microsoft.DotNet.Tools; +using LocalizableStrings = Microsoft.DotNet.Tools.List.LocalizableStrings; namespace Microsoft.DotNet.Cli { @@ -10,15 +11,15 @@ namespace Microsoft.DotNet.Cli { public static Command List() => Create.Command("list", - ".NET List Command", + LocalizableStrings.NetListCommand, Accept.ZeroOrOneArgument() - .With(name: "PROJECT", + .With(name: CommonLocalizableStrings.CmdProjectFile, description: - "The project file to operate on. If a file is not specified, the command will search the current directory for one.") + CommonLocalizableStrings.ArgumentsProjectDescription) .DefaultToCurrentDirectory(), CommonOptions.HelpOption(), Create.Command("reference", - LocalizableStrings.AppFullName, + Tools.List.ProjectToProjectReferences.LocalizableStrings.AppFullName, Accept.ZeroOrOneArgument(), CommonOptions.HelpOption())); } diff --git a/src/dotnet/commands/dotnet-migrate/MigrateCommandParser.cs b/src/dotnet/commands/dotnet-migrate/MigrateCommandParser.cs index fc64a0c74..f5f5c771f 100644 --- a/src/dotnet/commands/dotnet-migrate/MigrateCommandParser.cs +++ b/src/dotnet/commands/dotnet-migrate/MigrateCommandParser.cs @@ -15,34 +15,32 @@ namespace Microsoft.DotNet.Cli "migrate", ".NET Migrate Command", Accept.ZeroOrOneArgument() - .MaterializeAs(o => - { - return new MigrateCommand( - o.ValueOrDefault("--template-file"), - o.Arguments.FirstOrDefault(), - o.ValueOrDefault("--sdk-package-version"), - o.ValueOrDefault("--xproj-file"), - o.ValueOrDefault("--report-file"), - o.ValueOrDefault("--skip-project-references"), - o.ValueOrDefault("--format-report-file-json"), - o.ValueOrDefault("--skip-backup")); - }) - .With(name: LocalizableStrings.CmdProjectArgument, - description: LocalizableStrings.CmdProjectArgumentDescription), + .MaterializeAs(o => + new MigrateCommand( + o.ValueOrDefault("--template-file"), + o.Arguments.FirstOrDefault(), + o.ValueOrDefault("--sdk-package-version"), + o.ValueOrDefault("--xproj-file"), + o.ValueOrDefault("--report-file"), + o.ValueOrDefault("--skip-project-references"), + o.ValueOrDefault("--format-report-file-json"), + o.ValueOrDefault("--skip-backup"))) + .With(name: LocalizableStrings.CmdProjectArgument, + description: LocalizableStrings.CmdProjectArgumentDescription), CommonOptions.HelpOption(), Create.Option("-t|--template-file", - LocalizableStrings.CmdTemplateDescription), + LocalizableStrings.CmdTemplateDescription), Create.Option("-v|--sdk-package-version", - LocalizableStrings.CmdVersionDescription), + LocalizableStrings.CmdVersionDescription), Create.Option("-x|--xproj-file", - LocalizableStrings.CmdXprojFileDescription), + LocalizableStrings.CmdXprojFileDescription), Create.Option("-s|--skip-project-references", - LocalizableStrings.CmdSkipProjectReferencesDescription), + LocalizableStrings.CmdSkipProjectReferencesDescription), Create.Option("-r|--report-file", - LocalizableStrings.CmdReportFileDescription), + LocalizableStrings.CmdReportFileDescription), Create.Option("--format-report-file-json", - LocalizableStrings.CmdReportOutputDescription), + LocalizableStrings.CmdReportOutputDescription), Create.Option("--skip-backup", - LocalizableStrings.CmdSkipBackupDescription)); + LocalizableStrings.CmdSkipBackupDescription)); } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/RemoveCommandParser.cs b/src/dotnet/commands/dotnet-remove/RemoveCommandParser.cs index 7a7dcfa01..c45c14599 100644 --- a/src/dotnet/commands/dotnet-remove/RemoveCommandParser.cs +++ b/src/dotnet/commands/dotnet-remove/RemoveCommandParser.cs @@ -3,7 +3,7 @@ using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Tools; -using LocalizableStrings = Microsoft.DotNet.Tools.Remove.ProjectToProjectReference.LocalizableStrings; +using LocalizableStrings = Microsoft.DotNet.Tools.Remove.LocalizableStrings; namespace Microsoft.DotNet.Cli { @@ -11,30 +11,14 @@ namespace Microsoft.DotNet.Cli { public static Command Remove() => Create.Command("remove", - ".NET Remove Command", + LocalizableStrings.NetRemoveCommand, Accept.ExactlyOneArgument() .DefaultToCurrentDirectory() - .With(name: "PROJECT", + .With(name: CommonLocalizableStrings.CmdProjectFile, description: CommonLocalizableStrings.ArgumentsProjectDescription) .DefaultToCurrentDirectory(), CommonOptions.HelpOption(), - Create.Command( - "package", - LocalizableStrings.AppFullName, - CommonOptions.HelpOption()), - Create.Command( - "reference", - LocalizableStrings.AppFullName, - Accept - .OneOrMoreArguments() - .WithSuggestionsFrom(_ => Suggest.ProjectReferencesFromProjectFile()) - .With(name: "args", - description: LocalizableStrings.AppHelpText), - CommonOptions.HelpOption(), - Create.Option( - "-f|--framework", - "Remove reference only when targeting a specific framework", - Accept.ExactlyOneArgument() - .With(name: "FRAMEWORK")))); + RemovePackageParser.RemovePackage(), + RemoveProjectToProjectReferenceParser.RemoveReference()); } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-package/RemovePackageParser.cs b/src/dotnet/commands/dotnet-remove/dotnet-remove-package/RemovePackageParser.cs new file mode 100644 index 000000000..acfe8fa1c --- /dev/null +++ b/src/dotnet/commands/dotnet-remove/dotnet-remove-package/RemovePackageParser.cs @@ -0,0 +1,14 @@ +using Microsoft.DotNet.Cli.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.Remove.ProjectToProjectReference.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class RemovePackageParser + { + public static Command RemovePackage() => + Create.Command( + "package", + LocalizableStrings.AppFullName, + CommonOptions.HelpOption()); + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-remove/dotnet-remove-reference/RemoveProjectToProjectReferenceParser.cs b/src/dotnet/commands/dotnet-remove/dotnet-remove-reference/RemoveProjectToProjectReferenceParser.cs new file mode 100644 index 000000000..9489c9643 --- /dev/null +++ b/src/dotnet/commands/dotnet-remove/dotnet-remove-reference/RemoveProjectToProjectReferenceParser.cs @@ -0,0 +1,25 @@ +using Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Tools; +using LocalizableStrings = Microsoft.DotNet.Tools.Remove.ProjectToProjectReference.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + internal static class RemoveProjectToProjectReferenceParser + { + public static Command RemoveReference() => + Create.Command( + "reference", + LocalizableStrings.AppFullName, + Accept + .OneOrMoreArguments() + .WithSuggestionsFrom(_ => Suggest.ProjectReferencesFromProjectFile()) + .With(name: "args", + description: LocalizableStrings.AppHelpText), + CommonOptions.HelpOption(), + Create.Option( + "-f|--framework", + LocalizableStrings.CmdFrameworkDescription, + Accept.ExactlyOneArgument() + .With(name: CommonLocalizableStrings.CmdFramework))); + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-run/RunCommand.cs b/src/dotnet/commands/dotnet-run/RunCommand.cs index e9f0c8bdd..225757c50 100644 --- a/src/dotnet/commands/dotnet-run/RunCommand.cs +++ b/src/dotnet/commands/dotnet-run/RunCommand.cs @@ -16,14 +16,10 @@ namespace Microsoft.DotNet.Tools.Run public string Configuration { get; set; } public string Framework { get; set; } public string Project { get; set; } - public IReadOnlyList Args { get; set; } + public IReadOnlyCollection Args { get; set; } private List _args; - public RunCommand() - { - } - public int Start() { Initialize(); diff --git a/src/dotnet/commands/dotnet-run/RunCommandParser.cs b/src/dotnet/commands/dotnet-run/RunCommandParser.cs index 737e43b23..1dc22c122 100644 --- a/src/dotnet/commands/dotnet-run/RunCommandParser.cs +++ b/src/dotnet/commands/dotnet-run/RunCommandParser.cs @@ -1,7 +1,6 @@ // 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.Collections.Generic; using Microsoft.DotNet.Cli.CommandLine; using Microsoft.DotNet.Tools.Run; using LocalizableStrings = Microsoft.DotNet.Tools.Run.LocalizableStrings; @@ -14,27 +13,28 @@ namespace Microsoft.DotNet.Cli Create.Command( "run", LocalizableStrings.AppFullName, - Accept.ZeroOrMoreArguments() - .MaterializeAs(o => - { - return new RunCommand() - { - Configuration = o.SingleArgumentOrDefault("--configuration"), - Framework = o.SingleArgumentOrDefault("--framework"), - Project = o.SingleArgumentOrDefault("--project"), - Args = (IReadOnlyList)o.Arguments - }; - }), - CommonOptions.HelpOption(), - CommonOptions.ConfigurationOption(), - CommonOptions.FrameworkOption(), - Create.Option( - "-p|--project", - LocalizableStrings.CommandOptionProjectDescription, - Accept.ExactlyOneArgument()), - Create.Option( - "--no-build", - LocalizableStrings.CommandOptionNoBuildDescription, - Accept.NoArguments().ForwardAs("/p:NoBuild=true"))); + treatUnmatchedTokensAsErrors: false, + arguments: Accept.ZeroOrMoreArguments() + .MaterializeAs(o => new RunCommand + { + Configuration = o.SingleArgumentOrDefault("--configuration"), + Framework = o.SingleArgumentOrDefault("--framework"), + Project = o.SingleArgumentOrDefault("--project"), + Args = o.Arguments + }), + options: new[] + { + CommonOptions.HelpOption(), + CommonOptions.ConfigurationOption(), + CommonOptions.FrameworkOption(), + Create.Option( + "-p|--project", + LocalizableStrings.CommandOptionProjectDescription, + Accept.ExactlyOneArgument()), + Create.Option( + "--no-build", + LocalizableStrings.CommandOptionNoBuildDescription, + Accept.NoArguments().ForwardAs("/p:NoBuild=true")) + }); } -} +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-sln/SlnCommandParser.cs b/src/dotnet/commands/dotnet-sln/SlnCommandParser.cs index ce4865921..4be1ab9d6 100644 --- a/src/dotnet/commands/dotnet-sln/SlnCommandParser.cs +++ b/src/dotnet/commands/dotnet-sln/SlnCommandParser.cs @@ -12,27 +12,14 @@ namespace Microsoft.DotNet.Cli public static Command Sln() => Create.Command( "sln", - ".NET modify solution file command", + LocalizableStrings.AppFullName, Accept.ExactlyOneArgument() .DefaultToCurrentDirectory() - .With(name: "SLN_FILE", + .With(name: CommonLocalizableStrings.CmdSlnFile, description: CommonLocalizableStrings.ArgumentsSolutionDescription), CommonOptions.HelpOption(), - Create.Command("add", - ".NET Add project(s) to a solution file Command", - Accept.OneOrMoreArguments(o => CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd) - .With(name: "args", - description: LocalizableStrings.AddSubcommandHelpText), - CommonOptions.HelpOption()), - Create.Command("list", - ".NET List project(s) in a solution file Command", - CommonOptions.HelpOption()), - Create.Command("remove", - ".NET Remove project(s) from a solution file Command", - Accept.OneOrMoreArguments(o => CommonLocalizableStrings.SpecifyAtLeastOneProjectToRemove) - .With(name: "args", - description: LocalizableStrings.RemoveSubcommandHelpText), - CommonOptions.HelpOption())); - + SlnAddParser.SlnAdd(), + SlnListParser.SlnList(), + SlnRemoveParser.SlnRemove()); } } \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-sln/add/SlnAddParser.cs b/src/dotnet/commands/dotnet-sln/add/SlnAddParser.cs new file mode 100644 index 000000000..63685fb93 --- /dev/null +++ b/src/dotnet/commands/dotnet-sln/add/SlnAddParser.cs @@ -0,0 +1,20 @@ +// 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 Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Tools; +using LocalizableStrings = Microsoft.DotNet.Tools.Sln.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + public static class SlnAddParser + { + public static Command SlnAdd() => + Create.Command("add", + LocalizableStrings.AddAppFullName, + Accept.OneOrMoreArguments(o => CommonLocalizableStrings.SpecifyAtLeastOneProjectToAdd) + .With(name: "args", + description: LocalizableStrings.AddSubcommandHelpText), + CommonOptions.HelpOption()); + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-sln/list/SlnListParser.cs b/src/dotnet/commands/dotnet-sln/list/SlnListParser.cs new file mode 100644 index 000000000..ea16b2efe --- /dev/null +++ b/src/dotnet/commands/dotnet-sln/list/SlnListParser.cs @@ -0,0 +1,16 @@ +// 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 Microsoft.DotNet.Cli.CommandLine; +using LocalizableStrings = Microsoft.DotNet.Tools.Sln.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + public static class SlnListParser + { + public static Command SlnList() => + Create.Command("list", + LocalizableStrings.ListAppFullName, + CommonOptions.HelpOption()); + } +} \ No newline at end of file diff --git a/src/dotnet/commands/dotnet-sln/remove/SlnRemoveParser.cs b/src/dotnet/commands/dotnet-sln/remove/SlnRemoveParser.cs new file mode 100644 index 000000000..b650ba84c --- /dev/null +++ b/src/dotnet/commands/dotnet-sln/remove/SlnRemoveParser.cs @@ -0,0 +1,20 @@ +// 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 Microsoft.DotNet.Cli.CommandLine; +using Microsoft.DotNet.Tools; +using LocalizableStrings = Microsoft.DotNet.Tools.Sln.LocalizableStrings; + +namespace Microsoft.DotNet.Cli +{ + public static class SlnRemoveParser + { + public static Command SlnRemove() => + Create.Command("remove", + LocalizableStrings.RemoveAppFullName, + Accept.OneOrMoreArguments(o => CommonLocalizableStrings.SpecifyAtLeastOneProjectToRemove) + .With(name: "args", + description: LocalizableStrings.RemoveSubcommandHelpText), + CommonOptions.HelpOption()); + } +} \ No newline at end of file