mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 21:18:42 +00:00
Add cli overrides
This commit is contained in:
parent
09129a4f7f
commit
19d0616324
2 changed files with 29 additions and 1 deletions
10
README.md
10
README.md
|
@ -57,6 +57,16 @@ yes
|
|||
21:15:30 [INFO] Installation complete!
|
||||
```
|
||||
|
||||
### Unsupported crates
|
||||
|
||||
To install an unsupported crate, you may specify the Cargo.toml metadata entries for `pkg-url`, `bin-dir`, and `pkg-fmt` at the command line, with values [as documented below](#supporting-binary-installation).
|
||||
|
||||
For example:
|
||||
```
|
||||
$ binstall \
|
||||
--pkg-url="{ repo }/releases/download/{ version }/{ name }-{ version }-{ target }.{ format }" \
|
||||
--pkg-fmt="txz" crate_name
|
||||
```
|
||||
|
||||
## Status
|
||||
|
||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -60,6 +60,18 @@ struct Options {
|
|||
/// Utility log level
|
||||
#[structopt(long, default_value = "info")]
|
||||
log_level: LevelFilter,
|
||||
|
||||
/// Override Cargo.toml package manifest bin-dir.
|
||||
#[structopt(long)]
|
||||
bin_dir: Option<String>,
|
||||
|
||||
/// Override Cargo.toml package manifest pkg-fmt.
|
||||
#[structopt(long)]
|
||||
pkg_fmt: Option<PkgFmt>,
|
||||
|
||||
/// Override Cargo.toml package manifest pkg-url.
|
||||
#[structopt(long)]
|
||||
pkg_url: Option<String>,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
|
@ -73,7 +85,12 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
}
|
||||
|
||||
// Load options
|
||||
let opts = Options::from_iter(args.iter());
|
||||
let mut opts = Options::from_iter(args.iter());
|
||||
let cli_overrides = PkgOverride {
|
||||
pkg_url: opts.pkg_url.take(),
|
||||
pkg_fmt: opts.pkg_fmt.take(),
|
||||
bin_dir: opts.bin_dir.take(),
|
||||
};
|
||||
|
||||
// Setup logging
|
||||
let mut log_config = ConfigBuilder::new();
|
||||
|
@ -133,6 +150,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
|||
meta.merge(&o);
|
||||
}
|
||||
|
||||
meta.merge(&cli_overrides);
|
||||
debug!("Found metadata: {:?}", meta);
|
||||
|
||||
// Compute install directory
|
||||
|
|
Loading…
Add table
Reference in a new issue