diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-06-29 00:42:31 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-06-29 00:42:31 +0100 |
| commit | d24315268c11d435bb9accbce87b7f46dda6ed3e (patch) | |
| tree | 66589cb6a15fa74d4b09683105c583e4a5c222b4 /nihil.cli/registry.ccm | |
| parent | 7741a9698d29f79aca3e47495dcdf87c7a712f42 (diff) | |
| download | nihil-d24315268c11d435bb9accbce87b7f46dda6ed3e.tar.gz nihil-d24315268c11d435bb9accbce87b7f46dda6ed3e.tar.bz2 | |
cli: improve command dispatch a bit
Diffstat (limited to 'nihil.cli/registry.ccm')
| -rw-r--r-- | nihil.cli/registry.ccm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nihil.cli/registry.ccm b/nihil.cli/registry.ccm new file mode 100644 index 0000000..0b9754d --- /dev/null +++ b/nihil.cli/registry.ccm @@ -0,0 +1,28 @@ +/* + * This source code is released into the public domain. + */ + +module; + +#include <memory> +#include <span> + +export module nihil.cli:registry; + +namespace nihil { + +export struct command; +export struct command_node; + +/* + * Register a command. This is guaranteed not to throw; errors will print + * a diagnostic and exit. + */ +auto register_command(command *cmd) noexcept -> void; + +/* + * Get previously registered commands. + */ +auto get_registered_commands() -> std::span<std::shared_ptr<command_node>>; + +} // namespace nihil |
