aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.cli/command.ccm
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-07-03 19:46:01 +0100
committerLexi Winter <lexi@le-fay.org>2025-07-03 19:46:01 +0100
commite9609dfea5a8210f9e1a23c0d80f53df7664e71a (patch)
treec07fe2e0a47ee8d5a93d135752e4d0f2dba7424e /nihil.cli/command.ccm
parentc5a27de4bc520a9ac3538e8960097a8a65428182 (diff)
downloadnihil-e9609dfea5a8210f9e1a23c0d80f53df7664e71a.tar.gz
nihil-e9609dfea5a8210f9e1a23c0d80f53df7664e71a.tar.bz2
cli: add a basic command-line option parserHEADmain
Diffstat (limited to 'nihil.cli/command.ccm')
-rw-r--r--nihil.cli/command.ccm6
1 files changed, 5 insertions, 1 deletions
diff --git a/nihil.cli/command.ccm b/nihil.cli/command.ccm
index 1bcb13f..ab7fa1a 100644
--- a/nihil.cli/command.ccm
+++ b/nihil.cli/command.ccm
@@ -20,6 +20,7 @@ export struct command;
// registry.ccm
auto register_command(command *cmd) noexcept -> void;
+auto unregister_command(command *cmd) noexcept -> void;
// A command. If constructed with a handler, this is a "real" command which can be invoked.
// Otherwise, it's a stub command that has children in the command tree.
@@ -60,7 +61,10 @@ export struct command final
command(command &&) = delete;
auto operator=(command &&) -> command & = delete;
- ~command() = default;
+ ~command()
+ {
+ unregister_command(this);
+ }
// Return the full path for this command.
[[nodiscard]] auto path(this command const &self) noexcept -> std::string_view