Change syntax of exec to use a -- to separate args from nenv args

main
trivernis 1 year ago
parent 5f9be9d6df
commit 11a007893c
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -2,6 +2,7 @@
A Node environment manager written in rust.
## Features
- Written in fast and safe rust
@ -9,6 +10,7 @@ A Node environment manager written in rust.
- Configuration for project specific versions
- Version matching with semver expressions
## Installation
You can either
@ -48,6 +50,20 @@ nenv default latest
nenv refresh
```
### Pinning binaries to specific node versions
```sh
# rome will always be executed with the lts version
nenv pin rome lts
# tsc will always be executed with the latest typescript version
nenv pin tsc latest
# undo
nenv unpin rome
nenv unpin tsc
```
### List nodejs versions
```sh

@ -75,7 +75,7 @@ pub struct ExecArgs {
pub command: String,
/// The arguments for the command
#[arg(trailing_var_arg = true, allow_hyphen_values = true)]
#[arg(last = true, allow_hyphen_values = true)]
pub args: Vec<OsString>,
}

@ -42,7 +42,11 @@ impl NodeApp {
#[cfg(not(windows))]
async fn write_wrapper_script(&self, path: &Path) -> Result<(), io::Error> {
fs::write(path, format!("#!/bin/sh\nnenv exec {} \"$@\"", self.name)).await?;
fs::write(
path,
format!("#!/bin/sh\nnenv exec {} -- \"$@\"", self.name),
)
.await?;
let src_metadata = self.path.metadata()?;
fs::set_permissions(&path, src_metadata.permissions()).await?;
@ -53,7 +57,7 @@ impl NodeApp {
async fn write_wrapper_script(&self, path: &Path) -> Result<(), io::Error> {
fs::write(
path.with_extension("bat"),
format!("@echo off\nnenv exec {} %*", self.name),
format!("@echo off\nnenv exec {} -- %*", self.name),
)
.await?;
let src_metadata = self.path.metadata()?;

Loading…
Cancel
Save