Commit c5cab1feb6f6619984f7071b9a33a8b77971c4a3
1 parent
915c6870
Adding place to inject code before callbacks
Showing
1 changed file
with
4 additions
and
0 deletions
include/CLI.hpp
| ... | ... | @@ -1111,6 +1111,9 @@ public: |
| 1111 | 1111 | return make_set(name, options, discription, opts|opts2, args...); |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | + /// This allows subclasses to inject code before callbacks but after parse | |
| 1115 | + virtual void pre_callback() {} | |
| 1116 | + | |
| 1114 | 1117 | /// Parses the command line - throws errors |
| 1115 | 1118 | void parse(int argc, char **argv) { |
| 1116 | 1119 | progname = argv[0]; |
| ... | ... | @@ -1172,6 +1175,7 @@ public: |
| 1172 | 1175 | if(positionals.size()>0) |
| 1173 | 1176 | throw PositionalError("[" + detail::join(positionals) + "]"); |
| 1174 | 1177 | |
| 1178 | + pre_callback(); | |
| 1175 | 1179 | run_callback(); |
| 1176 | 1180 | } |
| 1177 | 1181 | ... | ... |