-
Notifications
You must be signed in to change notification settings - Fork 401
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -27,41 +27,19 @@ _reportbug() | |||||
| done)' -- "$cur")) | ||||||
| return | ||||||
| ;; | ||||||
| --bts | -!(-*)B) | ||||||
| COMPREPLY=($(compgen -W "debian guug kde mandrake help" -- \ | ||||||
| "$cur")) | ||||||
| --tag | --ui | --interface | --type | --bts | --severity | --mode | -!(-*)[TutBS]) | ||||||
| COMPREPLY+=($( | ||||||
| compgen -W \ | ||||||
| '$("$1" $prev help 2>&1 | sed -ne /^[[:space:]]/p)' \ | ||||||
akinomyoga marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| '$("$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.
Uh oh!
There was an error while loading. Please reload this page.