Skip to content

Commit 3f56a37

Browse files
committed
Add has_option to cmdlinet
This allows a user to check that a particular option is accepted, which allows validation when not using the full `parse` routine.
1 parent 2c47e04 commit 3f56a37

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/util/cmdline.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class cmdlinet
3535
virtual void set(const std::string &option, const std::string &value);
3636
virtual void clear();
3737

38+
bool has_option(const std::string &option) const
39+
{
40+
return getoptnr(option).has_value();
41+
}
42+
3843
typedef std::vector<std::string> argst;
3944
argst args;
4045
std::string unknown_arg;

0 commit comments

Comments
 (0)