parse-options.h: extract common --cleanup option
The --cleanup option is commonly used. Extract it so that its definition is not repeated. Helped-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f29cd8620d
commit
ca04dc96d1
@ -1473,7 +1473,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
|
||||
OPT_BOOL('s', "signoff", &signoff, N_("add Signed-off-by:")),
|
||||
OPT_FILENAME('t', "template", &template_file, N_("use specified template file")),
|
||||
OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
|
||||
OPT_STRING(0, "cleanup", &cleanup_arg, N_("default"), N_("how to strip spaces and #comments from message")),
|
||||
OPT_CLEANUP(&cleanup_arg),
|
||||
OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")),
|
||||
{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
|
||||
N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
|
||||
|
@ -397,8 +397,7 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
|
||||
OPT_FILENAME('F', "file", &msgfile, N_("read message from file")),
|
||||
OPT_BOOL('e', "edit", &edit_flag, N_("force edit of tag message")),
|
||||
OPT_BOOL('s', "sign", &opt.sign, N_("annotated and GPG-signed tag")),
|
||||
OPT_STRING(0, "cleanup", &cleanup_arg, N_("mode"),
|
||||
N_("how to strip spaces and #comments from message")),
|
||||
OPT_CLEANUP(&cleanup_arg),
|
||||
OPT_STRING('u', "local-user", &keyid, N_("key-id"),
|
||||
N_("use another key to sign the tag")),
|
||||
OPT__FORCE(&force, N_("replace the tag if exists"), 0),
|
||||
|
@ -314,5 +314,6 @@ int parse_opt_passthru_argv(const struct option *, const char *, int);
|
||||
#define OPT_NO_CONTAINS(v, h) _OPT_CONTAINS_OR_WITH("no-contains", v, h, PARSE_OPT_NONEG)
|
||||
#define OPT_WITH(v, h) _OPT_CONTAINS_OR_WITH("with", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG)
|
||||
#define OPT_WITHOUT(v, h) _OPT_CONTAINS_OR_WITH("without", v, h, PARSE_OPT_HIDDEN | PARSE_OPT_NONEG)
|
||||
#define OPT_CLEANUP(v) OPT_STRING(0, "cleanup", v, N_("mode"), N_("how to strip spaces and #comments from message"))
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user