From c5cab1feb6f6619984f7071b9a33a8b77971c4a3 Mon Sep 17 00:00:00 2001 From: Henry Fredrick Schreiner Date: Sat, 4 Feb 2017 11:44:23 -0500 Subject: [PATCH] Adding place to inject code before callbacks --- include/CLI.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/CLI.hpp b/include/CLI.hpp index 09c691dc..5cfd52c5 100644 --- a/include/CLI.hpp +++ b/include/CLI.hpp @@ -1111,6 +1111,9 @@ public: 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 void parse(int argc, char **argv) { progname = argv[0]; @@ -1172,6 +1175,7 @@ public: if(positionals.size()>0) throw PositionalError("[" + detail::join(positionals) + "]"); + pre_callback(); run_callback(); }