parseopt: add flag to stop on first non option
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
363d59df1a
commit
a0ec9d25d9
@ -249,6 +249,8 @@ int parse_options(int argc, const char **argv, const struct option *options,
|
||||
const char *arg = args.argv[0];
|
||||
|
||||
if (*arg != '-' || !arg[1]) {
|
||||
if (flags & PARSE_OPT_STOP_AT_NON_OPTION)
|
||||
break;
|
||||
argv[j++] = args.argv[0];
|
||||
continue;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@ enum parse_opt_type {
|
||||
|
||||
enum parse_opt_flags {
|
||||
PARSE_OPT_KEEP_DASHDASH = 1,
|
||||
PARSE_OPT_STOP_AT_NON_OPTION = 2,
|
||||
};
|
||||
|
||||
enum parse_opt_option_flags {
|
||||
|
Loading…
Reference in New Issue
Block a user