fix version matching, now works with semver

This commit is contained in:
ryan 2020-12-31 15:32:58 +13:00
parent a6c70b41e2
commit ef6a3d0ef7
4 changed files with 210 additions and 45 deletions

View file

@ -18,8 +18,8 @@ struct Options {
name: String,
/// Filter for package version to install
#[structopt(long)]
version: Option<String>,
#[structopt(long, default_value = "*")]
version: String,
/// Override binary target, ignoring compiled version
#[structopt(long, default_value = TARGET)]
@ -30,14 +30,6 @@ struct Options {
#[structopt(long)]
install_path: Option<String>,
/// Do not cleanup temporary files on success
#[structopt(long)]
no_cleanup: bool,
/// Disable interactive mode / confirmation
#[structopt(long)]
no_confirm: bool,
/// Disable symlinking / versioned updates
#[structopt(long)]
no_symlinks: bool,
@ -46,6 +38,14 @@ struct Options {
#[structopt(long)]
dry_run: bool,
/// Disable interactive mode / confirmation
#[structopt(long)]
no_confirm: bool,
/// Do not cleanup temporary files on success
#[structopt(long)]
no_cleanup: bool,
/// Override manifest source.
/// This skips searching crates.io for a manifest and uses
/// the specified path directly, useful for debugging and
@ -59,7 +59,6 @@ struct Options {
}
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
@ -91,7 +90,7 @@ async fn main() -> Result<(), anyhow::Error> {
// TODO: support git-based fetches (whole repo name rather than just crate name)
let manifest_path = match opts.manifest_path.clone() {
Some(p) => p,
None => fetch_crate_cratesio(&opts.name, opts.version.as_deref(), temp_dir.path()).await?,
None => fetch_crate_cratesio(&opts.name, &opts.version, temp_dir.path()).await?,
};
debug!("Reading manifest: {}", manifest_path.display());