diff options
| author | Lexi Winter <lexi@le-fay.org> | 2025-07-01 17:07:04 +0100 |
|---|---|---|
| committer | Lexi Winter <lexi@le-fay.org> | 2025-07-01 17:07:04 +0100 |
| commit | 2e2d1bd3b6c7776b77c33b94f30ead89367a71e6 (patch) | |
| tree | 54d37ffadf8e677938d9b7a28e4e9b71be1e75c1 /nihil.cli/command_tree.cc | |
| parent | 36427c0966faa7aecd586b397ed9b845f18172f5 (diff) | |
| download | nihil-2e2d1bd3b6c7776b77c33b94f30ead89367a71e6.tar.gz nihil-2e2d1bd3b6c7776b77c33b94f30ead89367a71e6.tar.bz2 | |
add nihil.std
Diffstat (limited to 'nihil.cli/command_tree.cc')
| -rw-r--r-- | nihil.cli/command_tree.cc | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/nihil.cli/command_tree.cc b/nihil.cli/command_tree.cc index 2d14669..a77131a 100644 --- a/nihil.cli/command_tree.cc +++ b/nihil.cli/command_tree.cc @@ -1,18 +1,8 @@ -/* - * This source code is released into the public domain. - */ - -module; - -#include <iostream> -#include <memory> -#include <print> -#include <ranges> -#include <string> -#include <vector> - +// This source code is released into the public domain. module nihil.cli; +import nihil.std; + namespace nihil { command_tree_node::command_tree_node() @@ -64,7 +54,7 @@ auto command_tree_node::get_or_create_child(this command_tree_node &self, -> command_tree_node * { // Return the existing child, if there is one. - if (auto ptr = self.get_child(child); ptr != nullptr) + if (auto *ptr = self.get_child(child); ptr != nullptr) return ptr; // Insert a new child. @@ -135,11 +125,11 @@ auto command_tree::insert(this command_tree &self, auto command_tree::find(this command_tree const &self, int &argc, char **&argv) -> command_tree_node const * { - auto *this_node = &self.m_root_node; + auto const *this_node = &self.m_root_node; // Iterate until we don't find a child command, then return that node. while (argv[0] != nullptr) { - auto *next_node = this_node->get_child(argv[0]); + auto const *next_node = this_node->get_child(argv[0]); if (next_node == nullptr) return this_node; |
