From 0edf37b6ccee8242aa46f26aacda2edaff706bed Mon Sep 17 00:00:00 2001 From: Michael Tesch Date: Wed, 19 Dec 2018 21:58:37 +0100 Subject: [PATCH] accept single '-' as argument, such as in `cat -` (#153) --- include/cxxopts.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 1db7941..81ac11c 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -1723,7 +1723,7 @@ ParseResult::parse(int& argc, char**& argv) //not a flag // but if it starts with a `-`, then it's an error - if (argv[current][0] == '-') { + if (argv[current][0] == '-' && argv[current][1] != '\0') { throw option_syntax_exception(argv[current]); }