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