diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2018-05-20 20:40:07 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-05-21 06:23:14 +0200 |
commit | e11dca10cfb3ef1e561c3e789b346a9719f0344a (patch) | |
tree | c90664e9c42d3b5265b23c02127804524e97171d /git.c | |
parent | Move declaration for alias.c to alias.h (diff) | |
download | git-e11dca10cfb3ef1e561c3e789b346a9719f0344a.tar.xz git-e11dca10cfb3ef1e561c3e789b346a9719f0344a.zip |
completion: add and use --list-cmds=nohelpers
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git.c')
-rw-r--r-- | git.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -39,6 +39,18 @@ static int use_pager = -1; static void list_builtins(struct string_list *list, unsigned int exclude_option); +static void exclude_helpers_from_list(struct string_list *list) +{ + int i = 0; + + while (i < list->nr) { + if (strstr(list->items[i].string, "--")) + unsorted_string_list_delete_item(list, i, 0); + else + i++; + } +} + static int match_token(const char *spec, int len, const char *token) { int token_len = strlen(token); @@ -61,6 +73,8 @@ static int list_cmds(const char *spec) list_all_main_cmds(&list); else if (match_token(spec, len, "others")) list_all_other_cmds(&list); + else if (match_token(spec, len, "nohelpers")) + exclude_helpers_from_list(&list); else if (len > 5 && !strncmp(spec, "list-", 5)) { struct strbuf sb = STRBUF_INIT; |