Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions argparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,9 @@ argparse_parse(struct argparse *self, int argc, const char **argv)
if (self->flags & ARGPARSE_STOP_AT_NON_OPTION) {
goto end;
}
if (self->flags & ARGPARSE_NON_OPTION_IS_INVALID) {
goto unknown;
}
// if it's not option or is a single char '-', copy verbatim
self->out[self->cpidx++] = self->argv[0];
continue;
Expand Down
1 change: 1 addition & 0 deletions argparse.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ typedef int argparse_callback (struct argparse *self,

enum argparse_flag {
ARGPARSE_STOP_AT_NON_OPTION = 1,
ARGPARSE_NON_OPTION_IS_INVALID = 2,
};

enum argparse_option_type {
Expand Down