|
koutil
|
Represents the result of command-line parsing. More...
#include <result.h>
Public Member Functions | |
| result_base_t ()=default | |
| bool | has_error () const |
| Checks if any errors occurred. | |
| bool | need_exit () const |
| Checks if the parser requested program exit. | |
| const auto & | errors () const |
| Returns the list of error messages. | |
| void | add_error (std::string error) |
| Adds an error message. | |
| void | exit () |
| Marks the result as requiring exit. | |
Private Attributes | |
| bool | m_exit = false |
| std::vector< std::string > | m_errors |
Represents the result of command-line parsing.
The order in which options, arguments, and commands are added is significant:
|
default |
|
inline |
Adds an error message.
| error | Error text. |
|
inlinenodiscard |
Returns the list of error messages.
|
inline |
Marks the result as requiring exit.
–help to stop parsing.
|
inlinenodiscard |
Checks if any errors occurred.
|
inlinenodiscard |
Checks if the parser requested program exit.
–help to skip further validation and avoid errors when required arguments are missing.
|
private |
|
private |