Simplify synopsis string generation#316
Conversation
|
@swift-ci please test |
|
@natecook1000 I recommend hiding whitespace changes when viewing this diff |
|
@swift-ci please test |
2 similar comments
|
@swift-ci please test |
|
@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 |
|
|
||
| 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.
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.
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 |
| var synopsis: String { | ||
| let definitionSynopsis = definition.synopsis | ||
| switch definitionSynopsis.count { | ||
| // Filter out options that should not be displayed. |
|
@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