From cca91c2d1a266ca505af0f0b50c065d7b66f4d68 Mon Sep 17 00:00:00 2001 From: Ethan Brierley Date: Tue, 27 Jul 2021 07:20:27 +0100 Subject: [PATCH] Replace == with = in documentation (#31) * documentation tweak * Update README.md * Update README.md * Update README.md * Update main.rs * Update README.md * Update README.md Co-authored-by: Yohan Boogaert --- README.md | 23 +++++++++++++++-------- src/main.rs | 10 +--------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 668dbf7..43e73ec 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,14 @@ Create a new temporary project: * With no additional dependencies: `$ cargo-temp` - + * With multiple dependencies: `$ cargo-temp rand tokio` - -* With a dependency that have a fixed version: - `$ cargo-temp anyhow==1.0.13` + +* When specifying a version: + `$ cargo-temp anyhow=1.0` + * Using the [cargo's comparison requirements][comparison]: + `$ cargo-temp anyhow==1.0.13` ### Repositories @@ -36,8 +38,7 @@ Examples: * SSH `$ cargo-temp anyhow=ssh://git@github.com/dtolnay/anyhow.git` -This will add the repository on the default branch by default. You can choose -another branch or a revision: +To choose a branch or a revision: * Branch `$ cargo-temp anyhow=https://github.com/dtolnay/anyhow.git#branch=master` @@ -45,6 +46,8 @@ another branch or a revision: * Revision `$ cargo-temp anyhow=https://github.com/dtolnay/anyhow.git#rev=7e0f77a38` +Without a branch or a revision, cargo will use the default branch of the repository. + ## Features If you change your mind and decide to keep the project you can just delete the @@ -55,8 +58,8 @@ editor exits. The config file is located at `{CONFIG_DIR}/cargo-temp/config.toml`. When you run `cargo-temp` for the first time it will be created automatically. -We use the [XDG system](https://docs.rs/xdg/2.2.0/xdg/) for both Linux and OSX -and the [Know Folder system](https://docs.rs/dirs-2/3.0.1/dirs_2/) on Windows. +We use the [XDG system][xdg] for both Linux and OSX +and the [Known Folder system][knownfolder] on Windows. ### Temporary project directory @@ -89,3 +92,7 @@ editor_args = [ "--wait", "--new-window" ] editor = "C:\\Program Files\\Microsoft VS Code\\Code.exe" editor_args = [ "--wait", "--new-window" ] ``` + +[comparison]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#comparison-requirements +[xdg]: https://docs.rs/xdg/2.2.0/xdg/ +[knownfolder]: https://docs.rs/dirs-2/3.0.1/dirs_2/ diff --git a/src/main.rs b/src/main.rs index 6301ca4..a95bdd7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -19,7 +19,7 @@ struct Cli { /// Dependencies to add to `Cargo.toml`. /// /// The default version used is `*` but this can be replaced using `=`. - /// E.g. `cargo-temp anyhow==1.0.13` + /// E.g. `cargo-temp anyhow=1.0.13` #[clap(parse(from_str = parse_dependency))] dependencies: Vec, @@ -270,14 +270,6 @@ mod parse_dependency_tests { ) } - #[test] - fn dependency_with_minor_version() { - assert_eq!( - parse_dependency("anyhow==1.1.0"), - Dependency::CrateIo("anyhow".to_string(), Some("=1.1.0".to_string())) - ) - } - #[test] fn repository_with_http() { assert_eq!(