From 502daa7e5e63496ab7c627b4339033738fee5f5a Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Sun, 21 Apr 2024 19:50:32 -0300 Subject: [PATCH] Construct Nix command --- src/index.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 667f047..f156bb2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,7 +3,7 @@ import { ActionOptions, IdsToolbox, inputs } from "detsys-ts"; class UpdateFlakeLockAction { idslib: IdsToolbox; private nixOptions: string; - private targets: string; + private targets: string[]; private commitMessage: string; private pathToFlakeDir: string; @@ -18,12 +18,19 @@ class UpdateFlakeLockAction { this.idslib = new IdsToolbox(options); this.nixOptions = inputs.getString("nix-options"); - this.targets = inputs.getString("inputs"); + this.targets = inputs.getString("inputs").split(" "); this.commitMessage = inputs.getString("commit-msg"); this.pathToFlakeDir = inputs.getString("path-to-flake-dir"); } - async update(): Promise {} + async update(): Promise { + const inputFlags = this.targets + .map((input) => `--update-input ${input}`) + .join(" "); + const inputStr = this.targets.length > 1 ? `${inputFlags}` : undefined; + + const nixCommand = `nix ${this.nixOptions} flake lock ${inputStr} --commit-lock-file --commit-lock-file-summary "${this.commitMessage}"`; + } } function main(): void {