Skip to content

Commit

Permalink
_longopt: pick first long option on a line, not last
Browse files Browse the repository at this point in the history
Makes sense, and consistent with _parse_help.

Closes #286
  • Loading branch information
przepompownia authored and scop committed Mar 21, 2019
1 parent 80ba367 commit 54abb2e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -1878,7 +1878,8 @@ _longopt()

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( LC_ALL=C $1 --help 2>&1 | \
command sed -ne 's/.*\(--[-A-Za-z0-9]\{1,\}=\{0,1\}\).*/\1/p' | sort -u )" \
while read -r line; do [[ "$line" =~ --[-A-Za-z0-9]{1,}={0,1} ]] && echo "${BASH_REMATCH[0]}"; done | \
sort -u )" \
-- "$cur" ) )
[[ $COMPREPLY == *= ]] && compopt -o nospace
elif [[ "$1" == @(rmdir|chroot) ]]; then
Expand Down

0 comments on commit 54abb2e

Please sign in to comment.