dotenv-rs / dotenv

Library to help supply environment variables in testing and development
MIT License
566 stars 45 forks source link

What about providing a standalone CLI? #80

Open huangjj27 opened 2 years ago

huangjj27 commented 2 years ago

I just find out zenv and its CLI feature help me a lot. Would we get a standalone CLI too?

masklinn commented 2 years ago

FWIW there is a CLI bundled in dotenv: https://github.com/dotenv-rs/dotenv/blob/master/dotenv/src/bin/dotenv.rs

Apparently it's gated behind --features cli because otherwise you get clap even when you're just using the library, which I guess the original maintainer found unhelpful.

huangjj27 commented 2 years ago

Apparently it's gated behind --features cli

I tried this but can't install on Windows 10, it seems that the binary supports unix-like system only:

> cargo install dotenv -f --features cli
    Updating `rsproxy` index
  Installing dotenv v0.15.0
   Compiling winapi v0.3.9
   Compiling unicode-width v0.1.9
   Compiling vec_map v0.8.2
   Compiling strsim v0.8.0
   Compiling bitflags v1.3.2
   Compiling textwrap v0.11.0
   Compiling atty v0.2.14
   Compiling clap v2.34.0
   Compiling dotenv v0.15.0
error[E0433]: failed to resolve: could not find `unix` in `os`
 --> C:\Users\${MyUser}\.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\dotenv-0.15.0\src\bin\dotenv.rs:5:14
  |
5 | use std::os::unix::process::CommandExt;
  |              ^^^^ could not find `unix` in `os`

error[E0599]: no method named `exec` found for struct `Command` in the current scope
  --> C:\Users\${MyUser}\.cargo\registry\src\rsproxy.cn-8f6827c7555bfaf8\dotenv-0.15.0\src\bin\dotenv.rs:65:29
   |
65 |         let error = command.exec();
   |                             ^^^^ method not found in `Command`

Some errors have detailed explanations: E0433, E0599.
For more information about an error, try `rustc --explain E0433`.
error: could not compile `dotenv` due to 2 previous errors
error: failed to compile `dotenv v0.15.0`, intermediate artifacts can be found at `C:\Users\${MyUser}\AppData\Local\Temp\cargo-install27FPqx`