mirror of
https://github.com/NixOS/nix
synced 2025-06-30 07:33:16 +02:00
Merge remote-tracking branch 'origin/master' into flakes
This commit is contained in:
commit
f85606c431
6 changed files with 18 additions and 11 deletions
|
@ -303,6 +303,10 @@ MultiCommand::MultiCommand(const Commands & commands)
|
|||
.optional = true,
|
||||
.handler = {[=](std::string s) {
|
||||
assert(!command);
|
||||
if (auto alias = get(deprecatedAliases, s)) {
|
||||
warn("'%s' is a deprecated alias for '%s'", s, *alias);
|
||||
s = *alias;
|
||||
}
|
||||
if (auto prefix = needsCompletion(s)) {
|
||||
for (auto & [name, command] : commands)
|
||||
if (hasPrefix(name, *prefix))
|
||||
|
|
|
@ -248,6 +248,8 @@ public:
|
|||
|
||||
std::map<Command::Category, std::string> categories;
|
||||
|
||||
std::map<std::string, std::string> deprecatedAliases;
|
||||
|
||||
// Selected command, if any.
|
||||
std::optional<std::pair<std::string, ref<Command>>> command;
|
||||
|
||||
|
|
|
@ -463,8 +463,7 @@ string base64Encode(const string & s);
|
|||
string base64Decode(const string & s);
|
||||
|
||||
|
||||
/* Get a value for the specified key from an associate container, or a
|
||||
default value if the key doesn't exist. */
|
||||
/* Get a value for the specified key from an associate container. */
|
||||
template <class T>
|
||||
std::optional<typename T::mapped_type> get(const T & map, const typename T::key_type & key)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue