-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify synopsis string generation #316
Conversation
@swift-ci please test |
@natecook1000 I recommend hiding whitespace changes when viewing this diff |
@swift-ci please test |
Thanks, @rauhul! Do you mind dropping the whitespace changes? I'd rather not introduce conflicts with other things that are in flight. |
@natecook1000 yep I can drop the whitespace changes! |
@swift-ci please test |
@@ -371,7 +371,7 @@ extension HelpGenerationTests { | |||
USAGE: l [--remote <remote>] | |||
|
|||
OPTIONS: | |||
-t, -x, -y, --remote, --when, --time, -other, --there <remote> | |||
-t, -x, -y, -other, --remote, --there, --time, --when <remote> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm, other than moving short names to the beginning, the old version preserved the declaration order of the names, which seems important for at least some cases. What’s motivating this change in behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a fair point, I thought it made more sense to put the arguments in order, but you're right, using declaration order allows the user to move depreciated flags to the back of the help, I'll back out this change.
@swift-ci please test |
- Removes unused codepaths. - Simplifies synopsis string codepaths by removing optionality. This complexity is moved to the caller who is now responsible for filtering out hidden arguments and options. This change is desirable as it allows the caller to determine if the argument should be hidden. For example, while it makes sense to hide arguments in help text, it may not make sense to hide them when dumping the arguments for another tool to consume.
@swift-ci please test |
@@ -36,49 +36,48 @@ extension UsageGenerator { | |||
/// | |||
/// In `roff`. | |||
var synopsis: String { | |||
let definitionSynopsis = definition.synopsis | |||
switch definitionSynopsis.count { | |||
// Filter out options that should not be displayed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch 👍🏻
@swift-ci Please test |
complexity is moved to the caller who is now responsible for filtering
out hidden arguments and options. This change is desirable as it
allows the caller to determine if the argument should be hidden. For
example, while it makes sense to hide arguments in help text, it may
not make sense to hide them when dumping the arguments for another
tool to consume.
Checklist