CARGO-NEW(1)
πΈ CARGO-NEW(1) β the manual page, but make it cute π
okay bestie, welcome to cargo-new β the "omg new project era" command β¨ (yes the manual page is literally called CARGO-NEW(1), we love a title moment)
β¨ NAME β¨
cargo-new β Create a new Cargo package π
π¦ SYNOPSIS π¦
cargo new [options] path
π DESCRIPTION π
okay so. this command creates a brand new Cargo package in whatever directory you point it at. it's giving starter pack: you get a simple template with a Cargo.toml manifest, a sample source file, and a VCS ignore file. and if the directory isn't already chilling inside a VCS repository? it literally makes a new repository for you (see --vcs down below, iykyk). π
also!! if you want a similar command that creates a new manifest in an existing directory, go look at cargo-init(1). sibling behavior fr fr π«Ά
π OPTIONS π
π New Options π
--binβ Create a package with a binary target (src/main.rs). This is the default behavior, so if you do nothing, this is what you get. main character energy by default β¨--libβ Create a package with a library target (src/lib.rs). library girlies rise π¦--editionedition β Specify the Rust edition to use. Default is2024. Possible values:2015,2018,2021,2024. pick your era, bestie π--namename β Set the package name. Defaults to the directory name. so if you don't name it, it just steals the folder's name, iconic tbh π--vcsvcs β Initialize a new VCS repository for the given version control system (git,hg,pijul, orfossil) or do not initialize any version control at all (none). If not specified, defaults togitor the configuration valuecargo-new.vcs, ornoneif already inside a VCS repository. no cap, it checks where you already are π--registryregistry β This sets thepublishfield inCargo.tomlto the given registry name which will restrict publishing only to that registry.
Registry names are defined in Cargo config files https://doc.rust-lang.org/cargo/reference/config.html. If not specified, the default registry defined by the registry.default config key is used. If the default registry is not set and --registry is not used, the publish field will not be set which means that publishing will not be restricted. so it's a whole "who am I allowed to publish to" situation β
π Display Options π
-v,--verboseβ Use verbose output. May be specified twice for "very verbose" output which includes extra output such as dependency warnings and build script output. May also be specified with theterm.verboseconfig valuehttps://doc.rust-lang.org/cargo/reference/config.html. double it for the extra tea π-q,--quietβ Do not print cargo log messages. May also be specified with theterm.quietconfig valuehttps://doc.rust-lang.org/cargo/reference/config.html. shhh era π€«--colorwhen β Control when colored output is used. Valid values:auto(default): Automatically detect if color support is available on the terminal.always: Always display colors.never: Never display colors.
May also be specified with the term.color config value https://doc.rust-lang.org/cargo/reference/config.html. we love a colorful terminal π
π Common Options π
+toolchainβ If Cargo has been installed with rustup, and the first argument tocargobegins with+, it will be interpreted as a rustup toolchain name (such as+stableor+nightly). See the rustup documentationhttps://rust-lang.github.io/rustup/overrides.htmlfor more information about how toolchain overrides work. yes you can just be like "+nightly" and it obeys π§--configKEY=VALUE or PATH β Overrides a Cargo configuration value. The argument should be in TOML syntax ofKEY=VALUE, or provided as a path to an extra configuration file. This flag may be specified multiple times. See the command-line overrides sectionhttps://doc.rust-lang.org/cargo/reference/config.html#command-line-overridesfor more information. stack it as many times as you want, obsessed π-CPATH β 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 examplecargo -C path/to/my-project build.
β οΈ heads up bestie: this option is only available on the nightly channelhttps://doc.rust-lang.org/book/appendix-07-nightly-rust.htmland requires the-Z unstable-optionsflag to enable (see #10098https://github.com/rust-lang/cargo/issues/10098). so likeβ¦ not for everyone yet π
-h,--helpβ Prints help information. the classic π«Ά-Zflag β Unstable (nightly-only) flags to Cargo. Runcargo -Z helpfor details. chaotic experimental mode, enter at your own risk π
πΈ 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, go peek π
β EXIT STATUS β
0: Cargo succeeded. slay π101: Cargo failed to complete. not slay π
π EXAMPLES π
- Create a binary Cargo package in the given directory:
cargo new foo
π¦ SEE ALSO π¦
and that's the whole page, bestie β every last flag accounted for, no gatekeeping πβ¨
mwah π this was CARGO-NEW(1) (yep, same name top and bottom, it's a whole bookend situation), brought to you from the General Commands Manual. go make something cute, fr fr π
π¦ where this page comes from
- alpine 3.22: cargo-doc 1.87.0-r1 Β· Apache-2.0 OR MIT
- alpine 3.23: cargo-doc 1.91.1-r2 Β· Apache-2.0 OR MIT
- alpine 3.24: cargo-doc 1.96.1-r0 Β· Apache-2.0 OR MIT
- alpine 3.24: chromium-cargo-doc 1.97.0-r0 Β· Apache-2.0 OR MIT
- centos-stream 10: cargo 1.99.1-1.el10 Β· (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- centos-stream 9: cargo 1.99.1-1.el9 Β· (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- debian bookworm: cargo-web 1.96.0+dfsg1-1~deb12u2 Β· MIT OR Apache-2.0
- debian trixie: cargo-web 1.96.0+dfsg1-1~deb13u1+b1 Β· MIT OR Apache-2.0
- fedora 43: cargo 1.90.0-1.fc43 Β· (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 43: cargo 1.98.1-1.fc43
- fedora 43: cargo 1.99.0-1.fc43
- fedora 43: cargo 1.99.1-2.fc43 Β· (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 44: cargo 1.94.1-1.fc44 Β· (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- fedora 44: cargo 1.98.1-1.fc44
- fedora 44: cargo 1.99.0-1.fc44
- fedora 44: cargo 1.99.1-2.fc44 Β· (Apache-2.0 OR MIT) AND (Artistic-2.0 AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND Unicode-3.0)
- nixos 26.05: cargo 1.95.0
- opensuse-leap 16.0: cargo1.86 1.86.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.86 1.86.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.86 1.86.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.86 1.86.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.87 1.87.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.87 1.87.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.87 1.87.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.87 1.87.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.88 1.88.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.88 1.88.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.88 1.88.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.88 1.88.0-160000.2.2 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.89 1.89.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.89 1.89.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.89 1.89.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.89 1.89.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.90 1.90.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.90 1.90.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.90 1.90.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.90 1.90.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.91 1.91.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.91 1.91.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.91 1.91.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.91 1.91.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.92 1.92.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.92 1.92.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.92 1.92.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.92 1.92.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.93 1.93.0-160000.2.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.93 1.93.0-160000.2.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.93 1.93.0-160000.2.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.93 1.93.0-160000.2.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.94 1.94.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.95 1.95.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.96 1.96.1-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.97 1.97.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 Β· Apache-2.0 OR MIT
- opensuse-leap 16.0: cargo1.98 1.98.0-160000.1.1 Β· Apache-2.0 OR MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms