aboutsummaryrefslogtreecommitdiff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/args.cc5
-rw-r--r--src/libutil/args.hh5
2 files changed, 4 insertions, 6 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 8bd9c8aeb..61f9503ec 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -86,6 +86,7 @@ void Args::parseCmdline(const Strings & _cmdline)
throw UsageError("unrecognised flag '%1%'", arg);
}
else {
+ pos = rewriteArgs(cmdline, pos);
pendingArgs.push_back(*pos++);
if (processArgs(pendingArgs, false))
pendingArgs.clear();
@@ -390,10 +391,6 @@ 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))
diff --git a/src/libutil/args.hh b/src/libutil/args.hh
index 26f1bc11b..8069fd70f 100644
--- a/src/libutil/args.hh
+++ b/src/libutil/args.hh
@@ -115,6 +115,9 @@ protected:
virtual bool processArgs(const Strings & args, bool finish);
+ virtual Strings::iterator rewriteArgs(Strings & args, Strings::iterator pos)
+ { return pos; }
+
std::set<std::string> hiddenCategories;
public:
@@ -257,8 +260,6 @@ 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;