aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/args.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-02-26 14:55:54 +0100
committerEelco Dolstra <edolstra@gmail.com>2021-02-26 14:55:54 +0100
commit453c3a603f4e6fa3f8c706e73f9869bc7f76c640 (patch)
tree87d70db57d33a66cb8752a1fd6ee4ae57202c30e /src/libutil/args.cc
parent20ea1de77d9210e145d5ebb1dccd34c856149b2c (diff)
nix flake update: Recreate the lock file
This is probably what most people expect it to do. Fixes #3781. There is a new command 'nix flake lock' that has the old behaviour of 'nix flake update', i.e. it just adds missing lock file entries unless overriden using --update-input.
Diffstat (limited to 'src/libutil/args.cc')
-rw-r--r--src/libutil/args.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc
index 75eb19d28..afed0670f 100644
--- a/src/libutil/args.cc
+++ b/src/libutil/args.cc
@@ -19,6 +19,14 @@ void Args::addFlag(Flag && flag_)
if (flag->shortName) shortFlags[flag->shortName] = flag;
}
+void Args::removeFlag(const std::string & longName)
+{
+ auto flag = longFlags.find(longName);
+ assert(flag != longFlags.end());
+ if (flag->second->shortName) shortFlags.erase(flag->second->shortName);
+ longFlags.erase(flag);
+}
+
void Completions::add(std::string completion, std::string description)
{
assert(description.find('\n') == std::string::npos);