mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 20:48:43 +00:00
Merge pull request #147 from passcod/cli-overrides
Closes #70 Fixes #69
This commit is contained in:
commit
f0e7fa0111
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!
|
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 }.{ archive-format }" \
|
||||||
|
--pkg-fmt="txz" crate_name
|
||||||
|
```
|
||||||
|
|
||||||
## Status
|
## Status
|
||||||
|
|
||||||
|
|
20
src/main.rs
20
src/main.rs
|
@ -60,6 +60,18 @@ struct Options {
|
||||||
/// Utility log level
|
/// Utility log level
|
||||||
#[structopt(long, default_value = "info")]
|
#[structopt(long, default_value = "info")]
|
||||||
log_level: LevelFilter,
|
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]
|
#[tokio::main]
|
||||||
|
@ -73,7 +85,12 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load options
|
// 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
|
// Setup logging
|
||||||
let mut log_config = ConfigBuilder::new();
|
let mut log_config = ConfigBuilder::new();
|
||||||
|
@ -133,6 +150,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||||
meta.merge(&o);
|
meta.merge(&o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
meta.merge(&cli_overrides);
|
||||||
debug!("Found metadata: {:?}", meta);
|
debug!("Found metadata: {:?}", meta);
|
||||||
|
|
||||||
// Compute install directory
|
// Compute install directory
|
||||||
|
|
Loading…
Add table
Reference in a new issue