diff options
Diffstat (limited to 'source/apps/src/wandac/cli.cpp')
| -rw-r--r-- | source/apps/src/wandac/cli.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/apps/src/wandac/cli.cpp b/source/apps/src/wandac/cli.cpp new file mode 100644 index 0000000..6be1e18 --- /dev/null +++ b/source/apps/src/wandac/cli.cpp @@ -0,0 +1,30 @@ +#include "wanda/wandac/cli.hpp" + +#include <lyra/arg.hpp> +#include <lyra/help.hpp> + +#include <ostream> + +namespace wandac +{ + + auto cli::parse(lyra::args arguments, std::ostream & error_stream) -> bool + { + parser |= // + lyra::help(help) | // + lyra::arg{command, "command"}("The command to send to the deamon").required(); + + auto result = parser.parse(arguments); + + if (!result) + { + error_stream << "Error while processing command line arguments: " << result.message() << '\n' << parser << '\n'; + return false; + } + + return true; + } + + auto cli::print_usage(std::ostream & output_stream) -> void { output_stream << parser << '\n'; } + +} // namespace wandac |
