Commit 0edf37b6ccee8242aa46f26aacda2edaff706bed
Committed by
jarro2783
1 parent
5950d785
accept single '-' as argument, such as in `cat -` (#153)
Showing
1 changed file
with
1 additions
and
1 deletions
include/cxxopts.hpp
| ... | ... | @@ -1723,7 +1723,7 @@ ParseResult::parse(int& argc, char**& argv) |
| 1723 | 1723 | //not a flag |
| 1724 | 1724 | |
| 1725 | 1725 | // but if it starts with a `-`, then it's an error |
| 1726 | - if (argv[current][0] == '-') { | |
| 1726 | + if (argv[current][0] == '-' && argv[current][1] != '\0') { | |
| 1727 | 1727 | throw option_syntax_exception(argv[current]); |
| 1728 | 1728 | } |
| 1729 | 1729 | ... | ... |