Can't figure out how to get duct to install lunarvim

I want my script to install lunarvim,
but lunarvim has this unusual way of installing itself.

use duct::cmd;

fn main() {
    let command = cmd!("bash", "<(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)", "-y")
       .env("LV_BRANCH", "release-1.3/neovim-0.9"); 
    match command.stdout_capture().stderr_capture().unchecked().run() {
        Ok(result_command) => {
            match result_command.status.success() {
                true => {},
                false => {
                    panic!("Process returned an error:\n\n{:?}\n\nOutput stderr:\n\n{}", 
                    command,
                    String::from_utf8(result_command.stderr).map_err(|non_utf8| 
                        String::from_utf8_lossy(non_utf8.as_bytes()).into_owned())
                        .unwrap());
                },
            } 
        },
        Err(e) => panic!("failure: {e}"), 
    }
}

Result:

thread 'main' panicked at src/main.rs:11:21:
Process returned an error:

Io(Env("LV_BRANCH", "release-1.3/neovim-0.9"), Cmd(["bash", "<(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh)", "-y"]))

Output stderr:

bash: <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.4/neovim-0.9/utils/installer/install.sh): No such file or directory

As far as I can tell, duct doesn't support interpolation like that. Instead, you could perhaps run the curl command normally with cmd!, then .pipe(cmd!("bash").env(...))?

Alternatively, you could download the script from the URL inside Rust itself, then provide that as an argument directly (i.e. cmd!("bash", "-c", script).env(...)).

2 Likes

I can't use the -y argument with that, at least not that I know of.

You could try the second method, that might be easier? But could you also pipe into cmd!("bash", "-", "-y")?

That works.
I'm running into a bigger issue though.
lunarvim's support for python.