Commit Graph

5 Commits (main)

Author SHA1 Message Date
Ng Zhi An cdaf0be1f4 Add git completion helper to cl upload
This is similar in spirit to the helper flags in git subcommands, e.g.
try `git branch --git-completion-helper`. It provides a list of long
flags that the subcommands support, without repeating it manually in the
completion script. Note that this special flag is not returned in help,
so there is no noise.

To see the result, source the script, then `git cl upload --<TAB>`.

Change-Id: I82e280ceac5178b0e5fa52611b9a4125e6943337
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2209926
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
5 years ago
Ng Zhi An 4cfa04ff98 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/+/2209582
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
5 years ago
Ng Zhi An 620c56e90e Fix git cl completion
__git_cl_all_commands is a variable, so it should use the variable
parameter, ${}, not a command substitution $().

Change-Id: I81fc2c73afd85cc1f737af00fbc294d933145e22
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2205456
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
5 years ago
Henrique Ferreiro 8b35029c6b Use cached variable for git cl completion
__git_cl_all_commands is used to cache the result of
__git_cl_commands(), but the actual code wasn't using it and was calling
the function everytime instead.

Change-Id: Ia2ce32b7de2812349808ec9aceeacf5adf463700
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2190337
Reviewed-by: Andrii Shyshkalov <tandrii@google.com>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
5 years ago
tandrii e594e21959 Add git cl bash completition.
R=maruel@chromium.org,emso@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2269593002
9 years ago