diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-05-17 17:58:38 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-05-17 17:58:38 +0200 |
| commit | 577fc0845718ed8ad5bebf02a277c0579a817f77 (patch) | |
| tree | 3d1cdc53c426a0ba60a7996619a7b787850bb3b3 /source/apps/src/wandac/cli.cpp | |
| parent | de5bf7ca3b7a2bf6be35b86486b00dc6a071b950 (diff) | |
| download | wanda-577fc0845718ed8ad5bebf02a277c0579a817f77.tar.xz wanda-577fc0845718ed8ad5bebf02a277c0579a817f77.zip | |
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 |
