fork/cargo
git clone https://git.julia.blue/fork/cargo
4c39aaff6
0.91.0
1CARGO-NEW(1) 2 3NAME 4 cargo-new — Create a new Cargo package 5 6SYNOPSIS 7 cargo new [options] path 8 9DESCRIPTION 10 This command will create a new Cargo package in the given directory. 11 This includes a simple template with a Cargo.toml manifest, sample 12 source file, and a VCS ignore file. If the directory is not already in a 13 VCS repository, then a new repository is created (see --vcs below). 14 15 See cargo-init(1) for a similar command which will create a new manifest 16 in an existing directory. 17 18OPTIONS 19 New Options 20 --bin 21 Create a package with a binary target (src/main.rs). This is the 22 default behavior. 23 24 --lib 25 Create a package with a library target (src/lib.rs). 26 27 --edition edition 28 Specify the Rust edition to use. Default is 2024. Possible values: 29 2015, 2018, 2021, 2024 30 31 --name name 32 Set the package name. Defaults to the directory name. 33 34 --vcs vcs 35 Initialize a new VCS repository for the given version control system 36 (git, hg, pijul, or fossil) or do not initialize any version control 37 at all (none). If not specified, defaults to git or the 38 configuration value cargo-new.vcs, or none if already inside a VCS 39 repository. 40 41 --registry registry 42 This sets the publish field in Cargo.toml to the given registry name 43 which will restrict publishing only to that registry. 44 45 Registry names are defined in Cargo config files 46 <https://doc.rust-lang.org/cargo/reference/config.html>. If not 47 specified, the default registry defined by the registry.default 48 config key is used. If the default registry is not set and 49 --registry is not used, the publish field will not be set which 50 means that publishing will not be restricted. 51 52 Display Options 53 -v, --verbose 54 Use verbose output. May be specified twice for “very verbose” 55 output which includes extra output such as dependency warnings and 56 build script output. May also be specified with the term.verbose 57 config value 58 <https://doc.rust-lang.org/cargo/reference/config.html>. 59 60 -q, --quiet 61 Do not print cargo log messages. May also be specified with the 62 term.quiet config value 63 <https://doc.rust-lang.org/cargo/reference/config.html>. 64 65 --color when 66 Control when colored output is used. Valid values: 67 68 o auto (default): Automatically detect if color support is 69 available on the terminal. 70 71 o always: Always display colors. 72 73 o never: Never display colors. 74 75 May also be specified with the term.color config value 76 <https://doc.rust-lang.org/cargo/reference/config.html>. 77 78 Common Options 79 +toolchain 80 If Cargo has been installed with rustup, and the first argument to 81 cargo begins with +, it will be interpreted as a rustup toolchain 82 name (such as +stable or +nightly). See the rustup documentation 83 <https://rust-lang.github.io/rustup/overrides.html> for more 84 information about how toolchain overrides work. 85 86 --config KEY=VALUE or PATH 87 Overrides a Cargo configuration value. The argument should be in 88 TOML syntax of KEY=VALUE, or provided as a path to an extra 89 configuration file. This flag may be specified multiple times. See 90 the command-line overrides section 91 <https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides> 92 for more information. 93 94 -C PATH 95 Changes the current working directory before executing any specified 96 operations. This affects things like where cargo looks by default 97 for the project manifest (Cargo.toml), as well as the directories 98 searched for discovering .cargo/config.toml, for example. This 99 option must appear before the command name, for example cargo -C 100 path/to/my-project build. 101 102 This option is only available on the nightly channel 103 <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and 104 requires the -Z unstable-options flag to enable (see #10098 105 <https://github.com/rust-lang/cargo/issues/10098>). 106 107 -h, --help 108 Prints help information. 109 110 -Z flag 111 Unstable (nightly-only) flags to Cargo. Run cargo -Z help for 112 details. 113 114ENVIRONMENT 115 See the reference 116 <https://doc.rust-lang.org/cargo/reference/environment-variables.html> 117 for details on environment variables that Cargo reads. 118 119EXIT STATUS 120 o 0: Cargo succeeded. 121 122 o 101: Cargo failed to complete. 123 124EXAMPLES 125 1. Create a binary Cargo package in the given directory: 126 127 cargo new foo 128 129SEE ALSO 130 cargo(1), cargo-init(1) 131