From 65deb981eefb31a06c657c8f355516f90ded8ab2 Mon Sep 17 00:00:00 2001 From: xwjqv <35635774+xwjqv@users.noreply.github.com> Date: Sat, 10 Feb 2024 01:18:19 +0100 Subject: [PATCH 1/2] added --run and --runtime-input for Haskell --run was for Haskell only partially implemented and --runtime-input was completely missing. They are useful for starting an lsp. --- nix-script-haskell/src/main.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/nix-script-haskell/src/main.rs b/nix-script-haskell/src/main.rs index b267f097..f77cbf24 100644 --- a/nix-script-haskell/src/main.rs +++ b/nix-script-haskell/src/main.rs @@ -37,6 +37,10 @@ struct Opts { #[clap(long, requires("shell"))] run: Option, + /// In shell mode, run this command instead of a shell. + #[clap(long("runtime-input"), requires("shell"))] + runtime_input: Vec, + /// In shell mode, run a "pure" shell (that is, one that isolates the /// shell a little more from what you have in your environment.) #[clap(long, requires("shell"))] @@ -96,6 +100,19 @@ impl Opts { .arg(format!("ghcid {}", script.display())); } + if let Some(cmd) = self.run.as_deref() { + command + .arg("--run") + .arg(cmd); + } + + if !self.runtime_input.is_empty() { + command.arg("--runtime-input"); + for input in &self.runtime_input { + command.arg(input); + } + } + command.arg(script); command.args(args); From c8b323e76353ce1250e7ee2de9a5bfcdd0280ec8 Mon Sep 17 00:00:00 2001 From: xwjqv <35635774+xwjqv@users.noreply.github.com> Date: Sat, 10 Feb 2024 14:25:14 +0100 Subject: [PATCH 2/2] rustfmt nix-script-haskell/src/main.rs --- nix-script-haskell/src/main.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nix-script-haskell/src/main.rs b/nix-script-haskell/src/main.rs index f77cbf24..391d648c 100644 --- a/nix-script-haskell/src/main.rs +++ b/nix-script-haskell/src/main.rs @@ -101,9 +101,7 @@ impl Opts { } if let Some(cmd) = self.run.as_deref() { - command - .arg("--run") - .arg(cmd); + command.arg("--run").arg(cmd); } if !self.runtime_input.is_empty() {