Accept multiple inputs in nix flake update

This commit is contained in:
Olmo Kramer 2024-02-24 20:58:44 +01:00
parent d83008c3a7
commit 9f11b1b0c4
No known key found for this signature in database

View file

@ -88,7 +88,8 @@ public:
expectArgs({ expectArgs({
.label="inputs", .label="inputs",
.optional=true, .optional=true,
.handler={[&](std::string inputToUpdate){ .handler={[&](std::vector<std::string> inputsToUpdate){
for (auto inputToUpdate : inputsToUpdate) {
InputPath inputPath; InputPath inputPath;
try { try {
inputPath = flake::parseInputPath(inputToUpdate); inputPath = flake::parseInputPath(inputToUpdate);
@ -99,6 +100,7 @@ public:
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.");
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);