mirror of
https://github.com/CLIUtils/CLI11.git
synced 2025-05-02 13:43:52 +00:00
Adding place to inject code before callbacks
This commit is contained in:
parent
915c68703f
commit
c5cab1feb6
@ -1111,6 +1111,9 @@ public:
|
|||||||
return make_set(name, options, discription, opts|opts2, args...);
|
return make_set(name, options, discription, opts|opts2, args...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This allows subclasses to inject code before callbacks but after parse
|
||||||
|
virtual void pre_callback() {}
|
||||||
|
|
||||||
/// Parses the command line - throws errors
|
/// Parses the command line - throws errors
|
||||||
void parse(int argc, char **argv) {
|
void parse(int argc, char **argv) {
|
||||||
progname = argv[0];
|
progname = argv[0];
|
||||||
@ -1172,6 +1175,7 @@ public:
|
|||||||
if(positionals.size()>0)
|
if(positionals.size()>0)
|
||||||
throw PositionalError("[" + detail::join(positionals) + "]");
|
throw PositionalError("[" + detail::join(positionals) + "]");
|
||||||
|
|
||||||
|
pre_callback();
|
||||||
run_callback();
|
run_callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user