dotnet-installer/src/dotnet/CommonOptions.cs

29 lines
1.1 KiB
C#
Raw Normal View History

using System.IO;
using Microsoft.DotNet.Cli.CommandLine;
using Microsoft.DotNet.Tools.Common;
namespace Microsoft.DotNet.Cli
{
internal static class CommonOptions
{
public static Option HelpOption() =>
2017-03-06 20:53:26 -08:00
Create.Option(
"-h|--help",
"Show help information",
Accept.NoArguments,
materialize: o => o.Option.Command().HelpView());
public static Option VerbosityOption() =>
2017-03-06 20:53:26 -08:00
Create.Option(
"-v|--verbosity",
"Set the verbosity level of the command. Allowed values are q[uiet],<2C>m[inimal],<2C>n[ormal],<2C>d[etailed], and<6E>diag[nostic]",
Accept.AnyOneOf("q", "quiet",
"m", "minimal",
"n", "normal",
"d", "detailed")
.ForwardAs("/verbosity:{0}"));
public static ArgumentsRule DefaultToCurrentDirectory(this ArgumentsRule rule) =>
rule.With(defaultValue: () => PathUtility.EnsureTrailingSlash(Directory.GetCurrentDirectory()));
}
}