From e9609dfea5a8210f9e1a23c0d80f53df7664e71a Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Thu, 3 Jul 2025 19:46:01 +0100 Subject: cli: add a basic command-line option parser --- nihil.cli/command.ccm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nihil.cli/command.ccm') 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 -- cgit v1.2.3