From 2ecbbc6e3356b961e5d26604f4fce20bcb1a20c1 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Sat, 15 Mar 2025 17:05:35 -0700 Subject: [PATCH] Commands -> CommandMap This name, for a different type, is also vague. Change-Id: I76405e940f3f1761bf0d66ba985d8c1dfc0b2d59 --- lix/libcmd/command.cc | 4 ++-- lix/libcmd/command.hh | 2 +- lix/libutil/args.cc | 2 +- lix/libutil/args.hh | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lix/libcmd/command.cc b/lix/libcmd/command.cc index 54502fd56..fb3daedcf 100644 --- a/lix/libcmd/command.cc +++ b/lix/libcmd/command.cc @@ -14,9 +14,9 @@ namespace nix { RegisterCommand::CommandMap * RegisterCommand::commands = nullptr; -nix::Commands RegisterCommand::getCommandsFor(const std::vector & prefix) +nix::CommandMap RegisterCommand::getCommandsFor(const std::vector & prefix) { - nix::Commands res; + nix::CommandMap res; for (auto & [name, command] : *RegisterCommand::commands) { if (name.size() == prefix.size() + 1) { bool equal = true; diff --git a/lix/libcmd/command.hh b/lix/libcmd/command.hh index c6fe424ff..e6c910915 100644 --- a/lix/libcmd/command.hh +++ b/lix/libcmd/command.hh @@ -277,7 +277,7 @@ struct RegisterCommand commands->emplace(name, command); } - static nix::Commands getCommandsFor(const std::vector & prefix); + static nix::CommandMap getCommandsFor(const std::vector & prefix); }; template diff --git a/lix/libutil/args.cc b/lix/libutil/args.cc index 67d91c09c..de98c4fcc 100644 --- a/lix/libutil/args.cc +++ b/lix/libutil/args.cc @@ -458,7 +458,7 @@ std::optional Command::experimentalFeature () return { Xp::NixCommand }; } -MultiCommand::MultiCommand(const Commands & commands_, bool allowExternal) +MultiCommand::MultiCommand(const CommandMap & commands_, bool allowExternal) : commands(commands_), customCommandSearchPaths( allowExternal ? tokenizeString( diff --git a/lix/libutil/args.hh b/lix/libutil/args.hh index 8a5026547..9c911a9df 100644 --- a/lix/libutil/args.hh +++ b/lix/libutil/args.hh @@ -350,7 +350,7 @@ struct Command : virtual public Args virtual Category category() { return catDefault; } }; -typedef std::map(AsyncIoRoot &)>> Commands; +using CommandMap = std::map(AsyncIoRoot &)>>; /** * An argument parser that supports multiple subcommands, @@ -359,7 +359,7 @@ typedef std::map(AsyncIoRoot &)>> Comman class MultiCommand : public Command { public: - Commands commands; + CommandMap commands; Strings customCommandSearchPaths; bool isExternalSubcommand; @@ -370,7 +370,7 @@ public: */ std::optional>> command; - MultiCommand(const Commands & commands, bool allowExternal = false); + MultiCommand(const CommandMap & commands, bool allowExternal = false); bool processFlag(Strings::iterator & pos, Strings::iterator end) override;