Accept multiple arguments to nix flake update

Fixes: #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) {
for (const auto & inputToUpdate : inputsToUpdate) {
auto inputPath = flake::parseInputPath(inputToUpdate); auto inputPath = flake::parseInputPath(inputToUpdate);
if (lockFlags.inputUpdates.contains(inputPath)) if (lockFlags.inputUpdates.contains(inputPath))
warn("Input '%s' was specified multiple times. You may have done this by accident."); warn("Input '%s' was specified multiple times. You may have done this by accident.", inputToUpdate);
lockFlags.inputUpdates.insert(inputPath); 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);