Accept multiple arguments to nix flake update

Fixes: lix-project/lix#194

Change-Id: Ia7bd4f7640384be9827dbb7e2c594f0aa5f1aff8
This commit is contained in:
Nikodem Rabuliński 2024-05-17 21:50:38 +02:00 committed by jade
parent c55e93ca23
commit cc3674ea93

View file

@ -87,11 +87,13 @@ public:
expectArgs({ expectArgs({
.label="inputs", .label="inputs",
.optional=true, .optional=true,
.handler={[&](std::string inputToUpdate){ .handler={[&](std::vector<std::string> inputsToUpdate) {
auto inputPath = flake::parseInputPath(inputToUpdate); for (const auto & inputToUpdate : inputsToUpdate) {
if (lockFlags.inputUpdates.contains(inputPath)) auto inputPath = flake::parseInputPath(inputToUpdate);
warn("Input '%s' was specified multiple times. You may have done this by accident."); if (lockFlags.inputUpdates.contains(inputPath))
lockFlags.inputUpdates.insert(inputPath); warn("Input '%s' was specified multiple times. You may have done this by accident.", inputToUpdate);
lockFlags.inputUpdates.insert(inputPath);
}
}}, }},
.completer = {[&](AddCompletions & completions, size_t, std::string_view prefix) { .completer = {[&](AddCompletions & completions, size_t, std::string_view prefix) {
completeFlakeInputPath(completions, getEvalState(), getFlakeRefsForCompletion(), prefix); completeFlakeInputPath(completions, getEvalState(), getFlakeRefsForCompletion(), prefix);