Merge branch 'nd/completion-more-parameters'

The command line completion (in contrib/) has been taught to
complete more subcommand parameters.

* nd/completion-more-parameters:
  completion: add more parameter value completion
This commit is contained in:
Junio C Hamano
2019-03-07 09:59:57 +09:00
18 changed files with 126 additions and 4 deletions

View File

@ -2121,6 +2121,10 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
*opt_value = PATCH_FORMAT_HG;
else if (!strcmp(arg, "mboxrd"))
*opt_value = PATCH_FORMAT_MBOXRD;
/*
* Please update $__git_patchformat in git-completion.bash
* when you add new options
*/
else
return error(_("Invalid value for --patch-format: %s"), arg);
return 0;

View File

@ -1039,6 +1039,10 @@ static void handle_untracked_files_arg(struct wt_status *s)
s->show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;
else if (!strcmp(untracked_files_arg, "all"))
s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
/*
* Please update $__git_untracked_file_modes in
* git-completion.bash when you add new options
*/
else
die(_("Invalid untracked files mode '%s'"), untracked_files_arg);
}
@ -1180,6 +1184,10 @@ static int parse_and_validate_options(int argc, const char *argv[],
else if (!strcmp(cleanup_arg, "scissors"))
cleanup_mode = use_editor ? COMMIT_MSG_CLEANUP_SCISSORS :
COMMIT_MSG_CLEANUP_SPACE;
/*
* Please update _git_commit() in git-completion.bash when you
* add new options.
*/
else
die(_("Invalid cleanup mode %s"), cleanup_arg);

View File

@ -70,6 +70,10 @@ static enum help_format parse_help_format(const char *format)
return HELP_FORMAT_INFO;
if (!strcmp(format, "web") || !strcmp(format, "html"))
return HELP_FORMAT_WEB;
/*
* Please update _git_config() in git-completion.bash when you
* add new help formats.
*/
die(_("unrecognized help format '%s'"), format);
}

View File

@ -84,6 +84,10 @@ static int parse_decoration_style(const char *value)
return DECORATE_SHORT_REFS;
else if (!strcmp(value, "auto"))
return auto_decoration_style();
/*
* Please update _git_log() in git-completion.bash when you
* add new decoration styles.
*/
return -1;
}
@ -1228,6 +1232,10 @@ static int thread_callback(const struct option *opt, const char *arg, int unset)
*thread = THREAD_SHALLOW;
else if (!strcmp(arg, "deep"))
*thread = THREAD_DEEP;
/*
* Please update _git_formatpatch() in git-completion.bash
* when you add new options.
*/
else
return 1;
return 0;

View File

@ -56,6 +56,10 @@ static enum rebase_type parse_config_rebase(const char *key, const char *value,
return REBASE_MERGES;
else if (!strcmp(value, "interactive") || !strcmp(value, "i"))
return REBASE_INTERACTIVE;
/*
* Please update _git_config() in git-completion.bash when you
* add new rebase modes.
*/
if (fatal)
die(_("Invalid value for %s: %s"), key, value);

View File

@ -82,6 +82,10 @@ static int list_replace_refs(const char *pattern, const char *format)
data.format = REPLACE_FORMAT_MEDIUM;
else if (!strcmp(format, "long"))
data.format = REPLACE_FORMAT_LONG;
/*
* Please update _git_replace() in git-completion.bash when
* you add new format
*/
else
return error(_("invalid replace format '%s'\n"
"valid formats are 'short', 'medium' and 'long'"),