Command to easily maintain rust dependencies with command line

Cargo edit

Cargo edit extends cargo by adding the following subcommands.
As you can guess by their names, the subcommands modify Cargo.toml from the command line.

cargo add
cargo rm
cargo upgrade

Install

$ cargo install cargo-e…


This content originally appeared on DEV Community and was authored by Kaito Ii

Cargo edit

Cargo edit extends cargo by adding the following subcommands.
As you can guess by their names, the subcommands modify Cargo.toml from the command line.

  • cargo add
  • cargo rm
  • cargo upgrade

Install

$ cargo install cargo-edit

cargo add

$ cargo add image
Updating 'https://github.com/rust-lang/crates.io-index' index
Adding image v0.23.14 to dependencies

$ cat Cargo.toml                                                                                                          [dependencies]
image = "0.23.14"

Add dependencies with a specific version.

$ cargo add image --vers=0.20                                                                                                  Updating 'https://github.com/rust-lang/crates.io-index' index
      Adding image v0.20 to dependencies

 ii@ii-pro  ~/t/r/image   master ⁝ ?
 $ cat Cargo.toml                                                                                                           [dependencies]
image = "0.20"

cargo upgrade

$ cargo upgrade image                                                                                                      
    Updating 'https://github.com/rust-lang/crates.io-index' index
image:
    Upgrading image v0.20 -> v0.23.14

cargo rm

$ cargo rm image
Removing image from dependencies

$ cat Cargo.toml                                                                                                           


This content originally appeared on DEV Community and was authored by Kaito Ii


Print Share Comment Cite Upload Translate Updates
APA

Kaito Ii | Sciencx (2021-03-21T04:11:24+00:00) Command to easily maintain rust dependencies with command line. Retrieved from https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/

MLA
" » Command to easily maintain rust dependencies with command line." Kaito Ii | Sciencx - Sunday March 21, 2021, https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/
HARVARD
Kaito Ii | Sciencx Sunday March 21, 2021 » Command to easily maintain rust dependencies with command line., viewed ,<https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/>
VANCOUVER
Kaito Ii | Sciencx - » Command to easily maintain rust dependencies with command line. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/
CHICAGO
" » Command to easily maintain rust dependencies with command line." Kaito Ii | Sciencx - Accessed . https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/
IEEE
" » Command to easily maintain rust dependencies with command line." Kaito Ii | Sciencx [Online]. Available: https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/. [Accessed: ]
rf:citation
» Command to easily maintain rust dependencies with command line | Kaito Ii | Sciencx | https://www.scien.cx/2021/03/21/command-to-easily-maintain-rust-dependencies-with-command-line/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.