diff options
author | Ben Burdette <bburdette@gmail.com> | 2020-06-11 14:06:35 -0600 |
---|---|---|
committer | Ben Burdette <bburdette@gmail.com> | 2020-06-11 14:06:35 -0600 |
commit | ef1b3f21b6e51007d82e8e894dd9ecec0d1c5207 (patch) | |
tree | 28ec34c71e98779d0b655a0b8e9070b981ee0cd9 /src/libutil/args.cc | |
parent | 94c347577ecea5dcd10a31ebfadf94db6ca5ab0d (diff) | |
parent | ac4d43a31bb32c1205b44d69e87606b7f54922a1 (diff) |
Merge remote-tracking branch 'upstream/master' into errors-phase-2
Diffstat (limited to 'src/libutil/args.cc')
-rw-r--r-- | src/libutil/args.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc index 10d6e89bb..ce6580119 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -217,10 +217,15 @@ MultiCommand::MultiCommand(const Commands & commands) { expectedArgs.push_back(ExpectedArg{"command", 1, true, [=](std::vector<std::string> ss) { assert(!command); - auto i = commands.find(ss[0]); + auto cmd = ss[0]; + if (auto alias = get(deprecatedAliases, cmd)) { + warn("'%s' is a deprecated alias for '%s'", cmd, *alias); + cmd = *alias; + } + auto i = commands.find(cmd); if (i == commands.end()) - throw UsageError("'%s' is not a recognised command", ss[0]); - command = {ss[0], i->second()}; + throw UsageError("'%s' is not a recognised command", cmd); + command = {cmd, i->second()}; }}); categories[Command::catDefault] = "Available commands"; |