Matthew Maurer | bd39854 | 2019-09-05 16:25:08 -0700 | [diff] [blame] | 1 | '\" t |
| 2 | .\" Title: cargo-new |
| 3 | .\" Author: [see the "AUTHOR(S)" section] |
| 4 | .\" Generator: Asciidoctor 1.5.8 |
| 5 | .\" Date: 2019-01-23 |
| 6 | .\" Manual: \ \& |
| 7 | .\" Source: \ \& |
| 8 | .\" Language: English |
| 9 | .\" |
| 10 | .TH "CARGO\-NEW" "1" "2019-01-23" "\ \&" "\ \&" |
| 11 | .ie \n(.g .ds Aq \(aq |
| 12 | .el .ds Aq ' |
| 13 | .ss \n[.ss] 0 |
| 14 | .nh |
| 15 | .ad l |
| 16 | .de URL |
| 17 | \fI\\$2\fP <\\$1>\\$3 |
| 18 | .. |
| 19 | .als MTO URL |
| 20 | .if \n[.g] \{\ |
| 21 | . mso www.tmac |
| 22 | . am URL |
| 23 | . ad l |
| 24 | . . |
| 25 | . am MTO |
| 26 | . ad l |
| 27 | . . |
| 28 | . LINKSTYLE blue R < > |
| 29 | .\} |
| 30 | .SH "NAME" |
| 31 | cargo\-new \- Create a new Cargo package |
| 32 | .SH "SYNOPSIS" |
| 33 | .sp |
| 34 | \fBcargo new [\fIOPTIONS\fP] \fIPATH\fP\fP |
| 35 | .SH "DESCRIPTION" |
| 36 | .sp |
| 37 | This command will create a new Cargo package in the given directory. This |
| 38 | includes a simple template with a \fBCargo.toml\fP manifest, sample source file, |
| 39 | and a VCS ignore file. If the directory is not already in a VCS repository, |
| 40 | then a new repository is created (see \fB\-\-vcs\fP below). |
| 41 | .sp |
| 42 | The "authors" field in the manifest is determined from the environment or |
| 43 | configuration settings. A name is required and is determined from (first match |
| 44 | wins): |
| 45 | .sp |
| 46 | .RS 4 |
| 47 | .ie n \{\ |
| 48 | \h'-04'\(bu\h'+03'\c |
| 49 | .\} |
| 50 | .el \{\ |
| 51 | . sp -1 |
| 52 | . IP \(bu 2.3 |
| 53 | .\} |
| 54 | \fBcargo\-new.name\fP Cargo config value |
| 55 | .RE |
| 56 | .sp |
| 57 | .RS 4 |
| 58 | .ie n \{\ |
| 59 | \h'-04'\(bu\h'+03'\c |
| 60 | .\} |
| 61 | .el \{\ |
| 62 | . sp -1 |
| 63 | . IP \(bu 2.3 |
| 64 | .\} |
| 65 | \fBCARGO_NAME\fP environment variable |
| 66 | .RE |
| 67 | .sp |
| 68 | .RS 4 |
| 69 | .ie n \{\ |
| 70 | \h'-04'\(bu\h'+03'\c |
| 71 | .\} |
| 72 | .el \{\ |
| 73 | . sp -1 |
| 74 | . IP \(bu 2.3 |
| 75 | .\} |
| 76 | \fBGIT_AUTHOR_NAME\fP environment variable |
| 77 | .RE |
| 78 | .sp |
| 79 | .RS 4 |
| 80 | .ie n \{\ |
| 81 | \h'-04'\(bu\h'+03'\c |
| 82 | .\} |
| 83 | .el \{\ |
| 84 | . sp -1 |
| 85 | . IP \(bu 2.3 |
| 86 | .\} |
| 87 | \fBGIT_COMMITTER_NAME\fP environment variable |
| 88 | .RE |
| 89 | .sp |
| 90 | .RS 4 |
| 91 | .ie n \{\ |
| 92 | \h'-04'\(bu\h'+03'\c |
| 93 | .\} |
| 94 | .el \{\ |
| 95 | . sp -1 |
| 96 | . IP \(bu 2.3 |
| 97 | .\} |
| 98 | \fBuser.name\fP git configuration value |
| 99 | .RE |
| 100 | .sp |
| 101 | .RS 4 |
| 102 | .ie n \{\ |
| 103 | \h'-04'\(bu\h'+03'\c |
| 104 | .\} |
| 105 | .el \{\ |
| 106 | . sp -1 |
| 107 | . IP \(bu 2.3 |
| 108 | .\} |
| 109 | \fBUSER\fP environment variable |
| 110 | .RE |
| 111 | .sp |
| 112 | .RS 4 |
| 113 | .ie n \{\ |
| 114 | \h'-04'\(bu\h'+03'\c |
| 115 | .\} |
| 116 | .el \{\ |
| 117 | . sp -1 |
| 118 | . IP \(bu 2.3 |
| 119 | .\} |
| 120 | \fBUSERNAME\fP environment variable |
| 121 | .RE |
| 122 | .sp |
| 123 | .RS 4 |
| 124 | .ie n \{\ |
| 125 | \h'-04'\(bu\h'+03'\c |
| 126 | .\} |
| 127 | .el \{\ |
| 128 | . sp -1 |
| 129 | . IP \(bu 2.3 |
| 130 | .\} |
| 131 | \fBNAME\fP environment variable |
| 132 | .RE |
| 133 | .sp |
| 134 | The email address is optional and is determined from: |
| 135 | .sp |
| 136 | .RS 4 |
| 137 | .ie n \{\ |
| 138 | \h'-04'\(bu\h'+03'\c |
| 139 | .\} |
| 140 | .el \{\ |
| 141 | . sp -1 |
| 142 | . IP \(bu 2.3 |
| 143 | .\} |
| 144 | \fBcargo\-new.email\fP Cargo config value |
| 145 | .RE |
| 146 | .sp |
| 147 | .RS 4 |
| 148 | .ie n \{\ |
| 149 | \h'-04'\(bu\h'+03'\c |
| 150 | .\} |
| 151 | .el \{\ |
| 152 | . sp -1 |
| 153 | . IP \(bu 2.3 |
| 154 | .\} |
| 155 | \fBCARGO_EMAIL\fP environment variable |
| 156 | .RE |
| 157 | .sp |
| 158 | .RS 4 |
| 159 | .ie n \{\ |
| 160 | \h'-04'\(bu\h'+03'\c |
| 161 | .\} |
| 162 | .el \{\ |
| 163 | . sp -1 |
| 164 | . IP \(bu 2.3 |
| 165 | .\} |
| 166 | \fBGIT_AUTHOR_EMAIL\fP environment variable |
| 167 | .RE |
| 168 | .sp |
| 169 | .RS 4 |
| 170 | .ie n \{\ |
| 171 | \h'-04'\(bu\h'+03'\c |
| 172 | .\} |
| 173 | .el \{\ |
| 174 | . sp -1 |
| 175 | . IP \(bu 2.3 |
| 176 | .\} |
| 177 | \fBGIT_COMMITTER_EMAIL\fP environment variable |
| 178 | .RE |
| 179 | .sp |
| 180 | .RS 4 |
| 181 | .ie n \{\ |
| 182 | \h'-04'\(bu\h'+03'\c |
| 183 | .\} |
| 184 | .el \{\ |
| 185 | . sp -1 |
| 186 | . IP \(bu 2.3 |
| 187 | .\} |
| 188 | \fBuser.email\fP git configuration value |
| 189 | .RE |
| 190 | .sp |
| 191 | .RS 4 |
| 192 | .ie n \{\ |
| 193 | \h'-04'\(bu\h'+03'\c |
| 194 | .\} |
| 195 | .el \{\ |
| 196 | . sp -1 |
| 197 | . IP \(bu 2.3 |
| 198 | .\} |
| 199 | \fBEMAIL\fP environment variable |
| 200 | .RE |
| 201 | .sp |
| 202 | See \c |
| 203 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "the reference" " " |
| 204 | for more information about |
| 205 | configuration files. |
| 206 | .sp |
| 207 | See \fBcargo\-init\fP(1) for a similar command which will create a new manifest |
| 208 | in an existing directory. |
| 209 | .SH "OPTIONS" |
| 210 | .SS "New Options" |
| 211 | .sp |
| 212 | \fB\-\-bin\fP |
| 213 | .RS 4 |
| 214 | Create a package with a binary target (\fBsrc/main.rs\fP). |
| 215 | This is the default behavior. |
| 216 | .RE |
| 217 | .sp |
| 218 | \fB\-\-lib\fP |
| 219 | .RS 4 |
| 220 | Create a package with a library target (\fBsrc/lib.rs\fP). |
| 221 | .RE |
| 222 | .sp |
| 223 | \fB\-\-edition\fP \fIEDITION\fP |
| 224 | .RS 4 |
| 225 | Specify the Rust edition to use. Default is 2018. |
| 226 | Possible values: 2015, 2018 |
| 227 | .RE |
| 228 | .sp |
| 229 | \fB\-\-name\fP \fINAME\fP |
| 230 | .RS 4 |
| 231 | Set the package name. Defaults to the directory name. |
| 232 | .RE |
| 233 | .sp |
| 234 | \fB\-\-vcs\fP \fIVCS\fP |
| 235 | .RS 4 |
| 236 | Initialize a new VCS repository for the given version control system (git, |
| 237 | hg, pijul, or fossil) or do not initialize any version control at all |
| 238 | (none). If not specified, defaults to \fBgit\fP or the configuration value |
| 239 | \fBcargo\-new.vcs\fP, or \fBnone\fP if already inside a VCS repository. |
| 240 | .RE |
| 241 | .sp |
| 242 | \fB\-\-registry\fP \fIREGISTRY\fP |
| 243 | .RS 4 |
| 244 | This sets the \fBpublish\fP field in \fBCargo.toml\fP to the given registry name |
| 245 | which will restrict publishing only to that registry. |
| 246 | .sp |
| 247 | Registry names are defined in \c |
| 248 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "Cargo config files" "." |
| 249 | If not specified, the default registry defined by the \fBregistry.default\fP |
| 250 | config key is used. If the default registry is not set and \fB\-\-registry\fP is not |
| 251 | used, the \fBpublish\fP field will not be set which means that publishing will not |
| 252 | be restricted. |
| 253 | .RE |
| 254 | .SS "Display Options" |
| 255 | .sp |
| 256 | \fB\-v\fP, \fB\-\-verbose\fP |
| 257 | .RS 4 |
| 258 | Use verbose output. May be specified twice for "very verbose" output which |
| 259 | includes extra output such as dependency warnings and build script output. |
| 260 | May also be specified with the \fBterm.verbose\fP |
| 261 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 262 | .RE |
| 263 | .sp |
| 264 | \fB\-q\fP, \fB\-\-quiet\fP |
| 265 | .RS 4 |
| 266 | No output printed to stdout. |
| 267 | .RE |
| 268 | .sp |
| 269 | \fB\-\-color\fP \fIWHEN\fP |
| 270 | .RS 4 |
| 271 | Control when colored output is used. Valid values: |
| 272 | .sp |
| 273 | .RS 4 |
| 274 | .ie n \{\ |
| 275 | \h'-04'\(bu\h'+03'\c |
| 276 | .\} |
| 277 | .el \{\ |
| 278 | . sp -1 |
| 279 | . IP \(bu 2.3 |
| 280 | .\} |
| 281 | \fBauto\fP (default): Automatically detect if color support is available on the |
| 282 | terminal. |
| 283 | .RE |
| 284 | .sp |
| 285 | .RS 4 |
| 286 | .ie n \{\ |
| 287 | \h'-04'\(bu\h'+03'\c |
| 288 | .\} |
| 289 | .el \{\ |
| 290 | . sp -1 |
| 291 | . IP \(bu 2.3 |
| 292 | .\} |
| 293 | \fBalways\fP: Always display colors. |
| 294 | .RE |
| 295 | .sp |
| 296 | .RS 4 |
| 297 | .ie n \{\ |
| 298 | \h'-04'\(bu\h'+03'\c |
| 299 | .\} |
| 300 | .el \{\ |
| 301 | . sp -1 |
| 302 | . IP \(bu 2.3 |
| 303 | .\} |
| 304 | \fBnever\fP: Never display colors. |
| 305 | .RE |
| 306 | .sp |
| 307 | May also be specified with the \fBterm.color\fP |
| 308 | .URL "https://doc.rust\-lang.org/cargo/reference/config.html" "config value" "." |
| 309 | .RE |
| 310 | .SS "Common Options" |
| 311 | .sp |
| 312 | \fB\-h\fP, \fB\-\-help\fP |
| 313 | .RS 4 |
| 314 | Prints help information. |
| 315 | .RE |
| 316 | .sp |
| 317 | \fB\-Z\fP \fIFLAG\fP... |
| 318 | .RS 4 |
| 319 | Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fP for |
| 320 | details. |
| 321 | .RE |
| 322 | .SH "ENVIRONMENT" |
| 323 | .sp |
| 324 | See \c |
| 325 | .URL "https://doc.rust\-lang.org/cargo/reference/environment\-variables.html" "the reference" " " |
| 326 | for |
| 327 | details on environment variables that Cargo reads. |
| 328 | .SH "EXIT STATUS" |
| 329 | .sp |
| 330 | 0 |
| 331 | .RS 4 |
| 332 | Cargo succeeded. |
| 333 | .RE |
| 334 | .sp |
| 335 | 101 |
| 336 | .RS 4 |
| 337 | Cargo failed to complete. |
| 338 | .RE |
| 339 | .SH "EXAMPLES" |
| 340 | .sp |
| 341 | .RS 4 |
| 342 | .ie n \{\ |
| 343 | \h'-04' 1.\h'+01'\c |
| 344 | .\} |
| 345 | .el \{\ |
| 346 | . sp -1 |
| 347 | . IP " 1." 4.2 |
| 348 | .\} |
| 349 | Create a binary Cargo package in the given directory: |
| 350 | .sp |
| 351 | .if n .RS 4 |
| 352 | .nf |
| 353 | cargo new foo |
| 354 | .fi |
| 355 | .if n .RE |
| 356 | .RE |
| 357 | .SH "SEE ALSO" |
| 358 | .sp |
| 359 | \fBcargo\fP(1), \fBcargo\-init\fP(1) |