Skip to content

feat(reportbug): parse various option args from option help - #852

Merged
scop merged 2 commits into
masterfrom
feat/reportbug-args-from-help
Dec 18, 2022
Merged

feat(reportbug): parse various option args from option help#852
scop merged 2 commits into
masterfrom
feat/reportbug-args-from-help

Conversation

@scop

@scop scop commented Dec 6, 2022

Copy link
Copy Markdown
Owner

Closes #753

It's unfortunate that the help output goes to stderr, but I suppose this is good enough.

@scop

scop commented Dec 6, 2022

Copy link
Copy Markdown
Owner Author

CI fail is unrelated, #853

Comment thread completions/reportbug Outdated
@scop
scop force-pushed the feat/reportbug-args-from-help branch from aace318 to dea48ff Compare December 6, 2022 19:55
Comment thread completions/reportbug
Comment thread completions/reportbug Outdated
--tag | --ui | --interface | --type | --bts | --severity | --mode | -!(-*)[TutBS])
COMPREPLY+=($(
compgen -W \
'$("$1" $prev help 2>&1 | sed -ne /^[[:space:]]/p)' \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thanks.

Copy link
Copy Markdown
Collaborator

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>
@scop
scop merged commit dd880e3 into master Dec 18, 2022
@scop
scop deleted the feat/reportbug-args-from-help branch December 18, 2022 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants