Skip to content

Commit

Permalink
Align version option in System.CommandLine usages (#78886)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 authored Nov 28, 2022
1 parent 62e87b4 commit 3c74d65
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/tools/ILVerify/ILVerifyRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ internal sealed class ILVerifyRootCommand : RootCommand
public Option<bool> Statistics { get; } =
new(new[] { "--statistics" }, "Print verification statistics");
public Option<bool> Verbose { get; } =
new(new[] { "--verbose", "-v" }, "Verbose output");
new(new[] { "--verbose" }, "Verbose output");
public Option<bool> Tokens { get; } =
new(new[] { "--tokens", "-t" }, "Include metadata tokens in error messages");

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/ILVerify/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ public PEReader Resolve(string simpleName)
private static int Main(string[] args) =>
new CommandLineBuilder(new ILVerifyRootCommand())
.UseTokenReplacer(Helpers.TryReadResponseFile)
.UseVersionOption()
.UseVersionOption("--version", "-v")
.UseHelp()
.UseParseErrorReporting()
.Build()
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/tools/aot/ILCompiler/ILCompilerRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ internal sealed class ILCompilerRootCommand : RootCommand
public Option<bool> Optimize { get; } =
new(new[] { "--optimize", "-O" }, "Enable optimizations");
public Option<bool> OptimizeSpace { get; } =
new(new[] { "--optimize-space", "-Os" }, "Enable optimizations, favor code space");
new(new[] { "--optimize-space", "--Os" }, "Enable optimizations, favor code space");
public Option<bool> OptimizeTime { get; } =
new(new[] { "--optimize-time", "-Ot" }, "Enable optimizations, favor code speed");
new(new[] { "--optimize-time", "--Ot" }, "Enable optimizations, favor code speed");
public Option<string[]> MibcFilePaths { get; } =
new(new[] { "--mibc", "-m" }, Array.Empty<string>, "Mibc file(s) for profile guided optimization");
public Option<bool> EnableDebugInfo { get; } =
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/aot/ILCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ private static IEnumerable<int> ProcessWarningCodes(IEnumerable<string> warningC
private static int Main(string[] args) =>
new CommandLineBuilder(new ILCompilerRootCommand(args))
.UseTokenReplacer(Helpers.TryReadResponseFile)
.UseVersionOption("-v")
.UseVersionOption("--version", "-v")
.UseHelp(context => context.HelpBuilder.CustomizeLayout(ILCompilerRootCommand.GetExtendedHelp))
.UseParseErrorReporting()
.Build()
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/tools/aot/crossgen2/Crossgen2RootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ internal class Crossgen2RootCommand : RootCommand
public Option<bool> Optimize { get; } =
new(new[] { "--optimize", "-O" }, SR.EnableOptimizationsOption);
public Option<bool> OptimizeDisabled { get; } =
new(new[] { "--optimize-disabled", "-Od" }, SR.DisableOptimizationsOption);
new(new[] { "--optimize-disabled", "--Od" }, SR.DisableOptimizationsOption);
public Option<bool> OptimizeSpace { get; } =
new(new[] { "--optimize-space", "-Os" }, SR.OptimizeSpaceOption);
new(new[] { "--optimize-space", "--Os" }, SR.OptimizeSpaceOption);
public Option<bool> OptimizeTime { get; } =
new(new[] { "--optimize-time", "-Ot" }, SR.OptimizeSpeedOption);
new(new[] { "--optimize-time", "--Ot" }, SR.OptimizeSpeedOption);
public Option<bool> InputBubble { get; } =
new(new[] { "--inputbubble" }, SR.InputBubbleOption);
public Option<Dictionary<string, string>> InputBubbleReferenceFilePaths { get; } =
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/aot/crossgen2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,7 @@ internal static bool IsValidPublicKey(byte[] blob)
private static int Main(string[] args) =>
new CommandLineBuilder(new Crossgen2RootCommand(args))
.UseTokenReplacer(Helpers.TryReadResponseFile)
.UseVersionOption("-v")
.UseVersionOption("--version", "-v")
.UseHelp(context => context.HelpBuilder.CustomizeLayout(Crossgen2RootCommand.GetExtendedHelp))
.UseParseErrorReporting()
.Build()
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/dotnet-pgo/PgoRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ internal sealed class PgoRootCommand : RootCommand
private Option<bool> _includeReadyToRun { get; } =
new("--includeReadyToRun", "Include ReadyToRun methods in the trace file");
private Option<Verbosity> _verbosity { get; } =
new(new[] { "--verbose", "-v" }, () => Verbosity.normal, "Adjust verbosity level. Supported levels are minimal, normal, detailed, and diagnostic");
new(new[] { "--verbose" }, () => Verbosity.normal, "Adjust verbosity level. Supported levels are minimal, normal, detailed, and diagnostic");
private Option<bool> _isSorted { get; } =
new("--sorted", "Generate sorted output.");
private Option<bool> _showTimestamp { get; } =
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/dotnet-pgo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public Program(PgoRootCommand command)
private static int Main(string[] args) =>
new CommandLineBuilder(new PgoRootCommand(args))
.UseTokenReplacer(Helpers.TryReadResponseFile)
.UseVersionOption("-v")
.UseVersionOption("--version", "-v")
.UseHelp(context => context.HelpBuilder.CustomizeLayout(PgoRootCommand.GetExtendedHelp))
.UseParseErrorReporting()
.Build()
Expand Down
1 change: 1 addition & 0 deletions src/coreclr/tools/r2rdump/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,7 @@ public int Run()
public static int Main(string[] args) =>
new CommandLineBuilder(new R2RDumpRootCommand())
.UseTokenReplacer(Helpers.TryReadResponseFile)
.UseVersionOption("--version", "-v")
.UseHelp()
.UseParseErrorReporting()
.Build()
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/tools/r2rdump/R2RDumpRootCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ internal sealed class R2RDumpRootCommand : RootCommand
public Option<bool> HideTransitions { get; } =
new(new[] { "--hide-transitions", "--ht" }, "Don't include GC transitions in disassembly output");
public Option<bool> Verbose { get; } =
new(new[] { "--verbose", "-v" }, "Dump disassembly, unwindInfo, gcInfo and sectionContents");
new(new[] { "--verbose" }, "Dump disassembly, unwindInfo, gcInfo and sectionContents");
public Option<bool> Diff { get; } =
new(new[] { "--diff" }, "Compare two R2R images");
public Option<bool> DiffHideSameDisasm { get; } =
Expand Down
7 changes: 3 additions & 4 deletions src/coreclr/tools/r2rtest/CommandLineOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,13 @@ void CreateCommand(string name, string description, Option[] options, Func<Build
public Option<DirectoryInfo> AspNetPath { get; } =
new Option<DirectoryInfo>(new[] { "--asp-net-path", "-asp" }, "Path to SERP's ASP.NET Core folder").AcceptExistingOnly();

static int Main(string[] args)
{
return new CommandLineBuilder(new R2RTestRootCommand())
private static int Main(string[] args) =>
new CommandLineBuilder(new R2RTestRootCommand())
.UseVersionOption("--version", "-v")
.UseHelp()
.UseParseErrorReporting()
.Build()
.Invoke(args);
}
}

public partial class BuildOptions
Expand Down

0 comments on commit 3c74d65

Please # to comment.