]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: use __gitcomp_builtin in _git_notes
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Fri, 9 Feb 2018 11:02:08 +0000 (18:02 +0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 9 Feb 2018 18:24:52 +0000 (10:24 -0800)
The new completable options are:

--allow-empty (notes add and notes append)
--for-rewrite= (notes copy)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c
contrib/completion/git-completion.bash

index b52e71c73e499d2f566678739ae581e188792b10..6990683bd482b6902af19324ddda60fecf300b2f 100644 (file)
@@ -413,7 +413,7 @@ static int add(int argc, const char **argv, const char *prefix)
                        parse_reuse_arg},
                OPT_BOOL(0, "allow-empty", &allow_empty,
                        N_("allow storing empty note")),
-               OPT__FORCE(&force, N_("replace existing notes"), 0),
+               OPT__FORCE(&force, N_("replace existing notes"), PARSE_OPT_NOCOMPLETE),
                OPT_END()
        };
 
@@ -484,7 +484,7 @@ static int copy(int argc, const char **argv, const char *prefix)
        struct notes_tree *t;
        const char *rewrite_cmd = NULL;
        struct option options[] = {
-               OPT__FORCE(&force, N_("replace existing notes"), 0),
+               OPT__FORCE(&force, N_("replace existing notes"), PARSE_OPT_NOCOMPLETE),
                OPT_BOOL(0, "stdin", &from_stdin, N_("read objects from stdin")),
                OPT_STRING(0, "for-rewrite", &rewrite_cmd, N_("command"),
                           N_("load rewriting config for <command> (implies "
index c7b8b37f196014ebfdbcc214ccb72c4750647d47..60127daebfd6ba4bd7eaa9a87447bf8212b8ef24 100644 (file)
@@ -1835,7 +1835,7 @@ _git_notes ()
 
        case "$subcommand,$cur" in
        ,--*)
-               __gitcomp '--ref'
+               __gitcomp_builtin notes
                ;;
        ,*)
                case "$prev" in
@@ -1851,15 +1851,17 @@ _git_notes ()
        add,--reedit-message=*|append,--reedit-message=*)
                __git_complete_refs --cur="${cur#*=}"
                ;;
-       add,--*|append,--*)
-               __gitcomp '--file= --message= --reedit-message=
-                               --reuse-message='
+       add,--*)
+               __gitcomp_builtin notes_add
+               ;;
+       append,--*)
+               __gitcomp_builtin notes_append
                ;;
        copy,--*)
-               __gitcomp '--stdin'
+               __gitcomp_builtin notes_copy
                ;;
        prune,--*)
-               __gitcomp '--dry-run --verbose'
+               __gitcomp_builtin notes_prune
                ;;
        prune,*)
                ;;