bash_completion: Fix cros autocompletion
Currently user would get '/bin/grep: Invalid range end' when trying to
autocomplete after 'cros '. This is because the '-' in the regex is
interpreted as range. Fix this by moving the - to the end of character
group.
BUG=None
TEST=manually try autocomplete 'cros '
Change-Id: I57356333be485fcd9935f98afc9152a2fa5c819e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/2328244
Tested-by: Pi-Hsun Shih <pihsun@chromium.org>
Auto-Submit: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
diff --git a/bash_completion b/bash_completion
index b8a5d62..63929bb 100644
--- a/bash_completion
+++ b/bash_completion
@@ -17,7 +17,7 @@
# {subcmd1,subcmd2,subcmd3}
_subcmds_from_help() {
sed -n -e '/commands:/,$p' \
- | egrep -o '\{[[:alnum:]_-,]+\}' | sort -u \
+ | egrep -o '\{[[:alnum:]_,-]+\}' | sort -u \
| tr -d '{}' | tr ',' ' '
return ${PIPESTATUS[0]}
}