Browse Source

completion: use __gitcomp_builtin in _git_notes

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>
maint
Nguyễn Thái Ngọc Duy 7 years ago committed by Junio C Hamano
parent
commit
7a60e3bb83
  1. 4
      builtin/notes.c
  2. 14
      contrib/completion/git-completion.bash

4
builtin/notes.c

@ -413,7 +413,7 @@ static int add(int argc, const char **argv, const char *prefix)
parse_reuse_arg}, parse_reuse_arg},
OPT_BOOL(0, "allow-empty", &allow_empty, OPT_BOOL(0, "allow-empty", &allow_empty,
N_("allow storing empty note")), 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() OPT_END()
}; };


@ -484,7 +484,7 @@ static int copy(int argc, const char **argv, const char *prefix)
struct notes_tree *t; struct notes_tree *t;
const char *rewrite_cmd = NULL; const char *rewrite_cmd = NULL;
struct option options[] = { 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_BOOL(0, "stdin", &from_stdin, N_("read objects from stdin")),
OPT_STRING(0, "for-rewrite", &rewrite_cmd, N_("command"), OPT_STRING(0, "for-rewrite", &rewrite_cmd, N_("command"),
N_("load rewriting config for <command> (implies " N_("load rewriting config for <command> (implies "

14
contrib/completion/git-completion.bash

@ -1835,7 +1835,7 @@ _git_notes ()


case "$subcommand,$cur" in case "$subcommand,$cur" in
,--*) ,--*)
__gitcomp '--ref' __gitcomp_builtin notes
;; ;;
,*) ,*)
case "$prev" in case "$prev" in
@ -1851,15 +1851,17 @@ _git_notes ()
add,--reedit-message=*|append,--reedit-message=*) add,--reedit-message=*|append,--reedit-message=*)
__git_complete_refs --cur="${cur#*=}" __git_complete_refs --cur="${cur#*=}"
;; ;;
add,--*|append,--*) add,--*)
__gitcomp '--file= --message= --reedit-message= __gitcomp_builtin notes_add
--reuse-message=' ;;
append,--*)
__gitcomp_builtin notes_append
;; ;;
copy,--*) copy,--*)
__gitcomp '--stdin' __gitcomp_builtin notes_copy
;; ;;
prune,--*) prune,--*)
__gitcomp '--dry-run --verbose' __gitcomp_builtin notes_prune
;; ;;
prune,*) prune,*)
;; ;;

Loading…
Cancel
Save