Accept multiple arguments to nix flake update

Fixes: https://git.lix.systems/lix-project/lix/issues/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({
.label="inputs",
.optional=true,
.handler={[&](std::string inputToUpdate){
auto inputPath = flake::parseInputPath(inputToUpdate);
if (lockFlags.inputUpdates.contains(inputPath))
warn("Input '%s' was specified multiple times. You may have done this by accident.");
lockFlags.inputUpdates.insert(inputPath);
.handler={[&](std::vector<std::string> inputsToUpdate) {
for (const auto & inputToUpdate : inputsToUpdate) {
auto inputPath = flake::parseInputPath(inputToUpdate);
if (lockFlags.inputUpdates.contains(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) {
completeFlakeInputPath(completions, getEvalState(), getFlakeRefsForCompletion(), prefix);