aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/args.cc
diff options
context:
space:
mode:
authorBen Burdette <bburdette@gmail.com>2020-06-11 14:06:35 -0600
committerBen Burdette <bburdette@gmail.com>2020-06-11 14:06:35 -0600
commitef1b3f21b6e51007d82e8e894dd9ecec0d1c5207 (patch)
tree28ec34c71e98779d0b655a0b8e9070b981ee0cd9 /src/libutil/args.cc
parent94c347577ecea5dcd10a31ebfadf94db6ca5ab0d (diff)
parentac4d43a31bb32c1205b44d69e87606b7f54922a1 (diff)
Merge remote-tracking branch 'upstream/master' into errors-phase-2
Diffstat (limited to 'src/libutil/args.cc')
-rw-r--r--src/libutil/args.cc11
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";