feat(reportbug): parse various option args from option help - #852
Merged
Conversation
Owner
Author
|
CI fail is unrelated, #853 |
akinomyoga
reviewed
Dec 6, 2022
scop
force-pushed
the
feat/reportbug-args-from-help
branch
from
December 6, 2022 19:55
aace318 to
dea48ff
Compare
akinomyoga
reviewed
Dec 6, 2022
akinomyoga
reviewed
Dec 18, 2022
| --tag | --ui | --interface | --type | --bts | --severity | --mode | -!(-*)[TutBS]) | ||
| COMPREPLY+=($( | ||
| compgen -W \ | ||
| '$("$1" $prev help 2>&1 | sed -ne /^[[:space:]]/p)' \ |
Collaborator
There was a problem hiding this comment.
Suggested change
| '$("$1" $prev help 2>&1 | sed -ne /^[[:space:]]/p)' \ | |
| '$("$1" $prev help 2>&1 </dev/null | sed -ne "/^[[:space:]]/p")' \ |
I also suggest quoting the regex passed to sed. I noticed that sed -ne /^[[:space:]]/p produces an error message and outputs the help text of sed in my Debian 10. This is caused by nullglob: the word /^[[:space:]]/p contains a glob pattern [[:space:]] matching nothing, so sed receives just an option -ne as its commandline arguments.
Collaborator
There was a problem hiding this comment.
I'm sorry. This workaround turned out to fail to produce the candidates. I expected that help should output candidates even without stdin, but it seems to fail when stdin is redirected /dev/null. I'll think about an alternative workaround.
Co-authored-by: Koichi Murase <myoga.murase@gmail.com>
akinomyoga
approved these changes
Dec 18, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #753
It's unfortunate that the help output goes to stderr, but I suppose this is good enough.