summaryrefslogtreecommitdiff
path: root/src/argparser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/argparser.h')
-rw-r--r--src/argparser.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/argparser.h b/src/argparser.h
index c5337e0..8f1ef39 100644
--- a/src/argparser.h
+++ b/src/argparser.h
@@ -237,6 +237,11 @@ public:
options.emplace_back(Opt<noarg>{shortopt, longopt, cb, help});
}
+ void add(const std::string& caption)
+ {
+ options.emplace_back(Opt<noarg>{{}, {}, {}, caption});
+ }
+
void set_pos_cb(std::function<int(std::string_view)> cb)
{
pos_cb = cb;
@@ -270,6 +275,11 @@ public:
using T = std::decay_t<decltype(opt)>;
if constexpr (std::is_same_v<T, Opt<noarg>>)
{
+ if(opt.longopt.empty())
+ {
+ std::cout << "\n" << opt.help << ":\n";
+ return;
+ }
}
else if constexpr (std::is_same_v<T, Opt<int>>)
{