Skip to content

Commit

Permalink
Eliminate the ambiguity of "-h" option
Browse files Browse the repository at this point in the history
Currently, the "-h" option serves as an alias for both
"--headerFile" and "--help" long options, causing ambiguity.
  • Loading branch information
myd7349 committed Jul 16, 2024
1 parent f0501f7 commit 732a522
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sources/ClangSharpPInvokeGenerator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public static class Program
private static readonly string[] s_withTransparentStructOptionAliases = ["--with-transparent-struct", "-wts"];
private static readonly string[] s_withTypeOptionAliases = ["--with-type", "-wt"];
private static readonly string[] s_withUsingOptionAliases = ["--with-using", "-wu"];
private static readonly string[] s_helpOptionAliases = ["--help", "-?"];

private static readonly Option<string[]> s_additionalOption = GetAdditionalOption();
private static readonly Option<string[]> s_configOption = GetConfigOption();
Expand Down Expand Up @@ -208,6 +209,7 @@ public static IEnumerable<HelpSectionDelegate> GetExtendedHelp(HelpContext conte
public static async Task<int> Main(params string[] args)
{
var parser = new CommandLineBuilder(s_rootCommand)
.UseHelp(s_helpOptionAliases)
.UseHelp(context => context.HelpBuilder.CustomizeLayout(GetExtendedHelp))
.UseEnvironmentVariableDirective()
.UseParseDirective()
Expand Down

0 comments on commit 732a522

Please sign in to comment.