Commit 4cfa04ff authored by Ng Zhi An's avatar Ng Zhi An Committed by LUCI CQ

Fix extra spaces in git cl completion

The commands come from the output of git cl -h, which then goes through
an sed filter, matching on the ANSI escape sequence for green and reset.
This ends up having extra spaces, since the output aligns the
subcommands based on the longest subcommand. For shorter commands like
archive, it becomes "archive   ". So, tweak the sed regex to only
capture the part without the whitespaces.

Change-Id: I80a84f142520478547895f85def68331575fdd72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2209582Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
parent 620c56e9
......@@ -19,7 +19,7 @@
# Parses commands from git cl -h.
__git_cl_commands () {
git cl -h 2> /dev/null | sed -n 's/^\s*\x1b\[32m\(.*\)\x1b\[39m.*$/\1/p'
git cl -h 2> /dev/null | sed -n 's/^\s*\x1b\[32m\(\S\+\)\s*\x1b\[39m.*$/\1/p'
}
# Caches variables in __git_cl_all_commands.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment