Commands -> CommandMap

This name, for a different type, is also vague.

Change-Id: I76405e940f3f1761bf0d66ba985d8c1dfc0b2d59
This commit is contained in:
Rebecca Turner
2025-03-15 21:27:22 -07:00
parent f1543bdf62
commit 2ecbbc6e33
4 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -14,9 +14,9 @@ namespace nix {
RegisterCommand::CommandMap * RegisterCommand::commands = nullptr;
nix::Commands RegisterCommand::getCommandsFor(const std::vector<std::string> & prefix)
nix::CommandMap RegisterCommand::getCommandsFor(const std::vector<std::string> & prefix)
{
nix::Commands res;
nix::CommandMap res;
for (auto & [name, command] : *RegisterCommand::commands) {
if (name.size() == prefix.size() + 1) {
bool equal = true;
+1 -1
View File
@@ -277,7 +277,7 @@ struct RegisterCommand
commands->emplace(name, command);
}
static nix::Commands getCommandsFor(const std::vector<std::string> & prefix);
static nix::CommandMap getCommandsFor(const std::vector<std::string> & prefix);
};
template<typename Base>
+1 -1
View File
@@ -458,7 +458,7 @@ std::optional<ExperimentalFeature> Command::experimentalFeature ()
return { Xp::NixCommand };
}
MultiCommand::MultiCommand(const Commands & commands_, bool allowExternal)
MultiCommand::MultiCommand(const CommandMap & commands_, bool allowExternal)
: commands(commands_),
customCommandSearchPaths(
allowExternal ? tokenizeString<Strings>(
+3 -3
View File
@@ -350,7 +350,7 @@ struct Command : virtual public Args
virtual Category category() { return catDefault; }
};
typedef std::map<std::string, std::function<ref<Command>(AsyncIoRoot &)>> Commands;
using CommandMap = std::map<std::string, std::function<ref<Command>(AsyncIoRoot &)>>;
/**
* An argument parser that supports multiple subcommands,
@@ -359,7 +359,7 @@ typedef std::map<std::string, std::function<ref<Command>(AsyncIoRoot &)>> Comman
class MultiCommand : public Command
{
public:
Commands commands;
CommandMap commands;
Strings customCommandSearchPaths;
bool isExternalSubcommand;
@@ -370,7 +370,7 @@ public:
*/
std::optional<std::pair<std::string, ref<Command>>> command;
MultiCommand(const Commands & commands, bool allowExternal = false);
MultiCommand(const CommandMap & commands, bool allowExternal = false);
bool processFlag(Strings::iterator & pos, Strings::iterator end) override;