From d7bc6c009bb728aff82032162095228ce12e2495 Mon Sep 17 00:00:00 2001 From: Tommaso Negri Date: Sun, 9 Aug 2026 15:33:16 +0200 Subject: pass block name to the command environment --- Sources/phbar/Models/Block.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Sources/phbar/Models/Block.swift') diff --git a/Sources/phbar/Models/Block.swift b/Sources/phbar/Models/Block.swift index 95c4ada..fe575e4 100644 --- a/Sources/phbar/Models/Block.swift +++ b/Sources/phbar/Models/Block.swift @@ -58,10 +58,14 @@ final class Block: ObservableObject, Identifiable { } /// Re-run the command and update the cells on the main actor. - func runScript() { + func runScript(env: [String: String] = [:]) { let command = self.command + + var env = env + env.updateValue(name, forKey: "BLOCK") + Task.detached(priority: .utility) { [weak self] in - let lines = Runner.run(command) + let lines = Runner.run(command, env: env) await self?.apply(lines) } } -- cgit v1.2.3