Eliminate the ambiguity of "-h" option #563
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the "-h" option serves as an alias for both "--headerFile" and "--help" long options, causing ambiguity.
When entering "ClangSharpPInvokeGenerator -h" in the command line, it prompts:
However, entering "ClangSharpPInvokeGenerator --help" outputs the help information correctly.
To eliminate ambiguity, we have three options:
Use "-h" as the short version of "--headerFile".
In this case, since "-h" cannot serve as the short version of "--help" anymore, we cannot rely on the default help message generated by System.Commandline. This aligns with the current behavior of "-h" as well.
Use "-h" as the short version of "--help".
In this case, we must change this line:
ClangSharp/sources/ClangSharpPInvokeGenerator/Program.cs
Line 31 in f0501f7
either delete the "-h" alias or use a different one(
-H
or-hf
, for example).(BTW, if we think
-hf
is a good option name, should we change the long version to--header-file
?)Replace
--headerFile
to another name, so that we can use a short option which is not-h
.This pull request adopts solution 1. Please let me know if you have any other preferences.