aboutsummaryrefslogtreecommitdiffstats
path: root/nihil.cli/registry.cc
diff options
context:
space:
mode:
authorLexi Winter <lexi@le-fay.org>2025-07-01 19:18:42 +0100
committerLexi Winter <lexi@le-fay.org>2025-07-01 19:18:42 +0100
commit378dd663a402fe196f2b56c6413eb3f623aecbbf (patch)
tree6d13f14ff8f9bff7c55a30eb046af489d0f677a2 /nihil.cli/registry.cc
parent2e2d1bd3b6c7776b77c33b94f30ead89367a71e6 (diff)
downloadnihil-378dd663a402fe196f2b56c6413eb3f623aecbbf.tar.gz
nihil-378dd663a402fe196f2b56c6413eb3f623aecbbf.tar.bz2
cli: refactoring
Diffstat (limited to 'nihil.cli/registry.cc')
-rw-r--r--nihil.cli/registry.cc22
1 files changed, 8 insertions, 14 deletions
diff --git a/nihil.cli/registry.cc b/nihil.cli/registry.cc
index 0f0041b..a972a65 100644
--- a/nihil.cli/registry.cc
+++ b/nihil.cli/registry.cc
@@ -5,13 +5,11 @@ import nihil.std;
namespace nihil {
-/*
- * Get the registry storage. Because this is called from global ctors,
- * it handles exceptions itself.
- */
-auto get_registry() noexcept -> std::vector<std::shared_ptr<command_node>> &
+// Get the registry storage. Because this is called from global ctors,
+// it handles exceptions itself.
+auto get_registry() noexcept -> std::vector<std::shared_ptr<command>> &
try {
- static auto commands = std::vector<std::shared_ptr<command_node>>();
+ static auto commands = std::vector<std::shared_ptr<command>>();
return commands;
} catch (std::exception const &exc) {
std::println(std::cerr, "{}", exc.what());
@@ -21,12 +19,10 @@ try {
std::exit(1); // NOLINT
}
-/*
- * Register a new command.
- */
+// Register a new command.
auto register_command(command *cmd) noexcept -> void
try {
- auto null_deleter = [] (command_node const *) -> void {};
+ auto null_deleter = [] (command const *) -> void {};
auto &commands = get_registry();
commands.emplace_back(cmd, null_deleter);
@@ -38,10 +34,8 @@ try {
std::exit(1); // NOLINT
}
-/*
- * Get the list of registered commands.
- */
-auto get_registered_commands() -> std::span<std::shared_ptr<command_node>>
+// Get the list of registered commands.
+auto get_registered_commands() -> std::span<std::shared_ptr<command>>
{
return {get_registry()};
}