-
Notifications
You must be signed in to change notification settings - Fork 391
feat(reportbug): parse various option args from option help #852
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
Conversation
CI fail is unrelated, #853 |
aace318
to
dea48ff
Compare
completions/reportbug
Outdated
--tag | --ui | --interface | --type | --bts | --severity | --mode | -!(-*)[TutBS]) | ||
COMPREPLY+=($( | ||
compgen -W \ | ||
'$("$1" $prev help 2>&1 | sed -ne /^[[:space:]]/p)' \ |
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.
'$("$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.
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.
Good catch, thanks.
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.
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>
Closes #753
It's unfortunate that the help output goes to stderr, but I suppose this is good enough.