cmdopt2/parser: add --help dispatch
This commit is contained in:
parent
1e1034711f
commit
f64d617156
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#include "./args.hpp"
|
#include "./args.hpp"
|
||||||
|
|
||||||
|
#include <cruft/util/container.hpp>
|
||||||
|
|
||||||
using cruft::cmdopt2::parser;
|
using cruft::cmdopt2::parser;
|
||||||
|
|
||||||
|
|
||||||
@ -163,6 +165,12 @@ parser::parse (int const argc, const char *const *argv)
|
|||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
return argc;
|
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 arg_cursor = 1;
|
||||||
int pos_cursor = 0;
|
int pos_cursor = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user