Closed
Description
Example (from nushell):
〉playground〉cargo add tokio@0.1.0 --optional --rename tokio_01
Updating crates.io index
Adding tokio v0.1.0 to optional dependencies.
〉playground〉cargo update
Updating crates.io index
# [snip]
〉playground〉open Cargo.lock | from toml | get package | where name == 'tokio'
╭───┬──────────────────────────────────────────────────────────────────┬─────────────────┬───────┬───────────────────────────────────────────────────────┬─────────╮
│ # │ checksum │ dependencies │ name │ source │ version │
├───┼──────────────────────────────────────────────────────────────────┼─────────────────┼───────┼───────────────────────────────────────────────────────┼─────────┤
│ 0 │ 5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6 │ [list 16 items] │ tokio │ registry+https://github.com/rust-lang/crates.io-index │ 0.1.22 │
╰───┴──────────────────────────────────────────────────────────────────┴─────────────────┴───────┴───────────────────────────────────────────────────────┴─────────╯
〉playground〉open Cargo.toml | get dependencies | get tokio_01
╭──────────┬───────╮
│ optional │ true │
│ package │ tokio │
│ version │ 0.1.0 │
╰──────────┴───────╯
〉playground〉open Cargo.lock | from toml | get package | where name == 'tokio'
╭───┬──────────────────────────────────────────────────────────────────┬─────────────────┬───────┬───────────────────────────────────────────────────────┬─────────╮
│ # │ checksum │ dependencies │ name │ source │ version │
├───┼──────────────────────────────────────────────────────────────────┼─────────────────┼───────┼───────────────────────────────────────────────────────┼─────────┤
│ 0 │ 5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6 │ [list 16 items] │ tokio │ registry+https://github.com/rust-lang/crates.io-index │ 0.1.22 │
╰───┴──────────────────────────────────────────────────────────────────┴─────────────────┴───────┴───────────────────────────────────────────────────────┴─────────╯
〉playground〉cargo upgrade --to-lockfile
Checking playground's dependencies
note: Re-run with `--pinned` to upgrade pinned version requirements
D:\git\cad97\playground〉open Cargo.toml | get dependencies | get tokio_01
╭──────────┬───────╮
│ optional │ true │
│ package │ tokio │
│ version │ 0.1.0 │
╰──────────┴───────╯