Skip to content
Snippets Groups Projects
Commit db2aaed2 authored by Martin Wölzer's avatar Martin Wölzer
Browse files

doc/doc.md: updated doc

parent 939c39b2
No related branches found
No related tags found
No related merge requests found
Pipeline #544 failed with stages
in 20 hours, 44 minutes, and 51 seconds
......@@ -580,7 +580,7 @@ string argument:
class cli_parser_t : public clapp::basic_main_parser_t {
public:
cli_parser_t() = default;
cli_parser_t();
~cli_parser_t() override;
......@@ -601,6 +601,7 @@ class cli_parser_t : public clapp::basic_main_parser_t {
cli_parser_t &operator=(cli_parser_t &&) noexcept = delete;
};
cli_parser_t::cli_parser_t() = default;
cli_parser_t::~cli_parser_t() = default;
int main(int argc, char *argv[]) {
......@@ -660,7 +661,7 @@ Caught Exception: Mandatory argument 'string-arg' not given.
# Give no mandatory option throws:
$ ./libclapp_doc_simple_main_parser -b my-string-arg
Caught Exception: Only the following mandatory options '-b|--bool' were given, but at least the following options are required: '-b|--bool', '-s|--str'
Caught Exception: Only the following mandatory options -b|--bool were given, but at least the following options are required: -b|--bool -s|--str=<param>
```
[//]:#end_calls_simple_main_parser
......@@ -959,6 +960,7 @@ But if you want to be conformant to [CppCoreGuideline C.21](https://github.com/i
If the previous example listing is executed, you get the following output:
[//]:#begin_calls_parser_container
```bash
# Print the help message:
$ ./libclapp_doc_parser_container -h # this is the same as with option `--help`
Usage:
./libclapp_doc_parser_container -h|--help | ( -b|--bool -s|--str=<param> ) <string-arg>
......@@ -1096,12 +1098,14 @@ this sub-parser.
class cli_parser_t : public clapp::basic_main_parser_t {
public:
cli_parser_t() = default;
cli_parser_t();
~cli_parser_t() override;
clapp::help_option_t help{*this, "help", 'h', "Show help options."};
clapp::help_option_t help{*this, "help", 'h', "Show help options.",
clapp::parser::types::purpose_t::optional};
clapp::int32_param_option_t int_opt{*this, 'i', "Int option"};
clapp::int32_param_option_t int_opt{
*this, 'i', "Int option", clapp::parser::types::purpose_t::optional};
class mode1_parser_t : public clapp::basic_sub_parser_t {
public:
......@@ -1112,7 +1116,9 @@ class cli_parser_t : public clapp::basic_main_parser_t {
clapp::help_option_t help{*this, "help", 'h', "Show help options.",
clapp::parser::types::purpose_t::optional};
clapp::string_param_option_t string{*this, 's', "String param option."};
clapp::string_param_option_t string{
*this, 's', "String param option.",
clapp::parser::types::purpose_t::optional};
// delete copy/mv-ctors and assignmet operators (CppCoreGuideline C.21):
explicit mode1_parser_t(const mode1_parser_t &) = delete;
......@@ -1150,6 +1156,7 @@ class cli_parser_t : public clapp::basic_main_parser_t {
cli_parser_t &operator=(cli_parser_t &&) noexcept = delete;
};
cli_parser_t::cli_parser_t() = default;
cli_parser_t::~cli_parser_t() = default;
cli_parser_t::mode1_parser_t::~mode1_parser_t() = default;
cli_parser_t::mode2_parser_t::~mode2_parser_t() = default;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment