1CARGO-INIT(1)                                                    CARGO-INIT(1)
2
3
4

NAME

6       cargo-init - Create a new Cargo package in an existing directory
7

SYNOPSIS

9       cargo init [OPTIONS] [PATH]
10

DESCRIPTION

12       This command will create a new Cargo manifest in the current directory.
13       Give a path as an argument to create in the given directory.
14
15       If there are typically-named Rust source files already in the
16       directory, those will be used. If not, then a sample src/main.rs file
17       will be created, or src/lib.rs if --lib is passed.
18
19       If the directory is not already in a VCS repository, then a new
20       repository is created (see --vcs below).
21
22       The "authors" field in the manifest is determined from the environment
23       or configuration settings. A name is required and is determined from
24       (first match wins):
25
26       ·   cargo-new.name Cargo config value
27
28       ·   CARGO_NAME environment variable
29
30       ·   GIT_AUTHOR_NAME environment variable
31
32       ·   GIT_COMMITTER_NAME environment variable
33
34       ·   user.name git configuration value
35
36       ·   USER environment variable
37
38       ·   USERNAME environment variable
39
40       ·   NAME environment variable
41
42       The email address is optional and is determined from:
43
44       ·   cargo-new.email Cargo config value
45
46       ·   CARGO_EMAIL environment variable
47
48       ·   GIT_AUTHOR_EMAIL environment variable
49
50       ·   GIT_COMMITTER_EMAIL environment variable
51
52       ·   user.email git configuration value
53
54       ·   EMAIL environment variable
55
56       See the reference
57       <https://doc.rust-lang.org/cargo/reference/config.html> for more
58       information about configuration files.
59
60       See cargo-new(1) for a similar command which will create a new package
61       in a new directory.
62

OPTIONS

64   Init Options
65       --bin
66           Create a package with a binary target (src/main.rs). This is the
67           default behavior.
68
69       --lib
70           Create a package with a library target (src/lib.rs).
71
72       --edition EDITION
73           Specify the Rust edition to use. Default is 2018. Possible values:
74           2015, 2018
75
76       --name NAME
77           Set the package name. Defaults to the directory name.
78
79       --vcs VCS
80           Initialize a new VCS repository for the given version control
81           system (git, hg, pijul, or fossil) or do not initialize any version
82           control at all (none). If not specified, defaults to git or the
83           configuration value cargo-new.vcs, or none if already inside a VCS
84           repository.
85
86       --registry REGISTRY
87           This sets the publish field in Cargo.toml to the given registry
88           name which will restrict publishing only to that registry.
89
90           Registry names are defined in Cargo config files
91           <https://doc.rust-lang.org/cargo/reference/config.html>. If not
92           specified, the default registry defined by the registry.default
93           config key is used. If the default registry is not set and
94           --registry is not used, the publish field will not be set which
95           means that publishing will not be restricted.
96
97   Display Options
98       -v, --verbose
99           Use verbose output. May be specified twice for "very verbose"
100           output which includes extra output such as dependency warnings and
101           build script output. May also be specified with the term.verbose
102           config value
103           <https://doc.rust-lang.org/cargo/reference/config.html>.
104
105       -q, --quiet
106           No output printed to stdout.
107
108       --color WHEN
109           Control when colored output is used. Valid values:
110
111           ·   auto (default): Automatically detect if color support is
112               available on the terminal.
113
114           ·   always: Always display colors.
115
116           ·   never: Never display colors.
117
118           May also be specified with the term.color config value
119           <https://doc.rust-lang.org/cargo/reference/config.html>.
120
121   Common Options
122       -h, --help
123           Prints help information.
124
125       -Z FLAG...
126           Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
127           details.
128

ENVIRONMENT

130       See the reference
131       <https://doc.rust-lang.org/cargo/reference/environment-variables.html>
132       for details on environment variables that Cargo reads.
133

EXIT STATUS

135       0
136           Cargo succeeded.
137
138       101
139           Cargo failed to complete.
140

EXAMPLES

142        1. Create a binary Cargo package in the current directory:
143
144               cargo init
145

SEE ALSO

147       cargo(1), cargo-new(1)
148
149
150
151                                  2019-01-23                     CARGO-INIT(1)
Impressum