CARGO-GENERATE-LOCKFILE(1)

πŸ“¦ version 1.89.0, in ubuntu jammy, ubuntu noble

✨ CARGO-GENERATE-LOCKFILE πŸ’–

okay so bestie, this is the manual page for cargo-generate-lockfile, living in the General Commands Manual section. it's giving "let me make you a lockfile" and honestly? iconic.


🌸 NAME 🌸

cargo-generate-lockfile β€” Generate the lockfile for a package


πŸŽ€ SYNOPSIS πŸŽ€

cargo generate-lockfile [options]

like that's it. that's the whole vibe. you just say it and it happens. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so this command? it creates the Cargo.lock lockfile for whatever package or workspace you're standing in. and if the lockfile is already there β€” like, already existing, already living its life β€” it will get rebuilt with the latest available version of every single package. no cap.

also, real talk, go check out cargo-update(1) too, because it can also make a Cargo.lock lockfile, and it's got way more options for controlling how the update behavior goes down. iykyk. 🫢


πŸ’… OPTIONS πŸ’…

✨ Display Options ✨

  • -v, --verbose β€” use verbose output. and yes, you can say it twice for "very verbose" output, which unlocks the extra stuff like dependency warnings and build script output. you can also set this with the term.verbose config value <https://doc.rust-lang.org/cargo/reference/config.html>. two v's = main character energy. πŸ‘‘
  • -q, --quiet β€” do NOT print cargo log messages. keep it cute and silent. may also be specified with the term.quiet config value <https://doc.rust-lang.org/cargo/reference/config.html>.
  • --color when β€” controls when colored output gets used. the valid values are:
    • auto (default): automatically detect if color support is available on the terminal. it just knows. 🧚
    • always: always display colors. rainbow mode activated. 🌈
    • never: never display colors. boring but valid.

may also be specified with the term.color config value <https://doc.rust-lang.org/cargo/reference/config.html>.

🌸 Manifest Options 🌸

  • --manifest-path path β€” path to the Cargo.toml file. by default, Cargo searches for the Cargo.toml file in the current directory or any parent directory. it's literally hunting for it. πŸ”
  • --ignore-rust-version β€” ignore rust-version specification in packages. we're not checking IDs today bestie.
  • --locked β€” asserts that the exact same dependencies and versions are used as when the existing Cargo.lock file was originally generated. Cargo will exit with an error when either of these scenarios arises:
    • the lock file is missing. 😭
    • Cargo attempted to change the lock file due to a different dependency resolution. πŸ’€

it may be used in environments where deterministic builds are desired, such as in CI pipelines. so if you need things to be exactly the same every single time, this is your girl.

  • --offline β€” prevents Cargo from accessing the network for any reason. without this flag, Cargo will stop with an error if it needs to access the network and the network is not available. with this flag, Cargo will attempt to proceed without the network if possible.
beware bestie!! this may result in different dependency resolution than online mode. Cargo will restrict itself to crates that are downloaded locally, even if there might be a newer version as indicated in the local copy of the index. see the cargo-fetch(1) command to download dependencies before going offline. ✈️

may also be specified with the net.offline config value <https://doc.rust-lang.org/cargo/reference/config.html>.

  • --frozen β€” equivalent to specifying both --locked and --offline. two for one deal, we love to see it. πŸ“
  • --lockfile-path PATH β€” changes the path of the lockfile from the default (<workspace_root>/Cargo.lock) to PATH. PATH must end with Cargo.lock (e.g. --lockfile-path /tmp/temporary-lockfile/Cargo.lock). note that providing --lockfile-path will ignore existing lockfile at the default path, and instead will either use the lockfile from PATH, or write a new lockfile into the provided PATH if it doesn't exist. this flag can be used to run most commands in read-only directories, writing lockfile into the provided PATH.
this option is only available on the nightly channel <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and requires the -Z unstable-options flag to enable (see #14421 <https://github.com/rust-lang/cargo/issues/14421>). so like... night mode only. πŸŒ™

πŸ’œ Common Options πŸ’œ

  • +toolchain β€” if Cargo has been installed with rustup, and the first argument to cargo begins with +, it will be interpreted as a rustup toolchain name (such as +stable or +nightly). see the rustup documentation <https://rust-lang.github.io/rustup/overrides.html> for more information about how toolchain overrides work.
  • --config KEY=VALUE or PATH β€” overrides a Cargo configuration value. the argument should be in TOML syntax of KEY=VALUE, or provided as a path to an extra configuration file. this flag may be specified multiple times. see the command-line overrides section <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides> for more information.
  • -C PATH β€” changes the current working directory before executing any specified operations. this affects things like where cargo looks by default for the project manifest (Cargo.toml), as well as the directories searched for discovering .cargo/config.toml, for example. this option must appear before the command name, for example cargo -C path/to/my-project build.
this option is only available on the nightly channel <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and requires the -Z unstable-options flag to enable (see #10098 <https://github.com/rust-lang/cargo/issues/10098>). again with the night mode πŸŒ™βœ¨
  • -h, --help β€” prints help information. when in doubt, ask for help. we support that here. 🫢
  • -Z flag β€” unstable (nightly-only) flags to Cargo. run cargo -Z help for details.

🌈 ENVIRONMENT 🌈

see the reference <https://doc.rust-lang.org/cargo/reference/environment-variables.html> for details on environment variables that Cargo reads. it's all in there bestie, go peek. πŸ‘€


⭐ EXIT STATUS ⭐

  • 0: Cargo succeeded. slay. πŸ’–
  • 101: Cargo failed to complete. not slay. 😭

🧚 EXAMPLES 🧚

  1. Create or update the lockfile for the current package or workspace:
cargo generate-lockfile

one command. one lockfile. periodt. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

cargo(1), cargo-update(1)


that's the whole page fr fr β€” from the CARGO-GENERATE-LOCKFILE(1) crew, General Commands Manual energy, and it's giving date-of-this-manual vibes. go forth and generate that lockfile, bestie. πŸ¦‹πŸ’–βœ¨

πŸ“¦ where this page comes from