cmdopt2/parser: add --help dispatch

This commit is contained in:
Danny Robson 2022-03-18 13:03:56 +10:00
parent 1e1034711f
commit f64d617156

View File

@ -2,6 +2,8 @@
#include "./args.hpp"
#include <cruft/util/container.hpp>
using cruft::cmdopt2::parser;
@ -163,6 +165,12 @@ parser::parse (int const argc, const char *const *argv)
if (argc <= 1)
return argc;
using namespace std::string_view_literals;
if (contains ("--help"sv, cruft::view (argv, argc))) {
usage (argc, argv, stdout);
exit (EXIT_SUCCESS);
}
int arg_cursor = 1;
int pos_cursor = 0;