382 lines
7.9 KiB
HTML
382 lines
7.9 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of CARGO-INIT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>CARGO-INIT</H1>
|
|
Section: (1)<BR>Updated: 2019-09-05<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
cargo-init - Create a new Cargo package in an existing directory
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
<B>cargo init [</B><I>OPTIONS</I>] [<I>PATH</I>]
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<P>
|
|
This command will create a new Cargo manifest in the current directory. Give a
|
|
path as an argument to create in the given directory.
|
|
<P>
|
|
If there are typically-named Rust source files already in the directory, those
|
|
will be used. If not, then a sample <B>src/main.rs</B> file will be created, or
|
|
<B>src/lib.rs</B> if <B>--lib</B> is passed.
|
|
<P>
|
|
If the directory is not already in a VCS repository, then a new repository
|
|
is created (see <B>--vcs</B> below).
|
|
<P>
|
|
The "authors" field in the manifest is determined from the environment or
|
|
configuration settings. A name is required and is determined from (first match
|
|
wins):
|
|
<P>
|
|
<DL COMPACT><DT id="1"><DD>
|
|
•
|
|
|
|
|
|
<B>cargo-new.name</B> Cargo config value
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="2"><DD>
|
|
•
|
|
|
|
|
|
<B>CARGO_NAME</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="3"><DD>
|
|
•
|
|
|
|
|
|
<B>GIT_AUTHOR_NAME</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="4"><DD>
|
|
•
|
|
|
|
|
|
<B>GIT_COMMITTER_NAME</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="5"><DD>
|
|
•
|
|
|
|
|
|
<B>user.name</B> git configuration value
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="6"><DD>
|
|
•
|
|
|
|
|
|
<B>USER</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="7"><DD>
|
|
•
|
|
|
|
|
|
<B>USERNAME</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="8"><DD>
|
|
•
|
|
|
|
|
|
<B>NAME</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
The email address is optional and is determined from:
|
|
<P>
|
|
<DL COMPACT><DT id="9"><DD>
|
|
•
|
|
|
|
|
|
<B>cargo-new.email</B> Cargo config value
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="10"><DD>
|
|
•
|
|
|
|
|
|
<B>CARGO_EMAIL</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="11"><DD>
|
|
•
|
|
|
|
|
|
<B>GIT_AUTHOR_EMAIL</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="12"><DD>
|
|
•
|
|
|
|
|
|
<B>GIT_COMMITTER_EMAIL</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="13"><DD>
|
|
•
|
|
|
|
|
|
<B>user.email</B> git configuration value
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="14"><DD>
|
|
•
|
|
|
|
|
|
<B>EMAIL</B> environment variable
|
|
</DL>
|
|
|
|
<P>
|
|
See
|
|
<I>the reference</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>
|
|
|
|
for more information about
|
|
configuration files.
|
|
<P>
|
|
See <B><A HREF="/cgi-bin/man/man2html?1+cargo-new">cargo-new</A></B>(1) for a similar command which will create a new package in
|
|
a new directory.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>OPTIONS</H2>
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H3>Init Options</H3>
|
|
|
|
<P>
|
|
<B>--bin</B>
|
|
<DL COMPACT><DT id="15"><DD>
|
|
Create a package with a binary target (<B>src/main.rs</B>).
|
|
This is the default behavior.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--lib</B>
|
|
<DL COMPACT><DT id="16"><DD>
|
|
Create a package with a library target (<B>src/lib.rs</B>).
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--edition</B> <I>EDITION</I>
|
|
<DL COMPACT><DT id="17"><DD>
|
|
Specify the Rust edition to use. Default is 2018.
|
|
Possible values: 2015, 2018
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--name</B> <I>NAME</I>
|
|
<DL COMPACT><DT id="18"><DD>
|
|
Set the package name. Defaults to the directory name.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--vcs</B> <I>VCS</I>
|
|
<DL COMPACT><DT id="19"><DD>
|
|
Initialize a new VCS repository for the given version control system (git,
|
|
hg, pijul, or fossil) or do not initialize any version control at all
|
|
(none). If not specified, defaults to <B>git</B> or the configuration value
|
|
<B>cargo-new.vcs</B>, or <B>none</B> if already inside a VCS repository.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--registry</B> <I>REGISTRY</I>
|
|
<DL COMPACT><DT id="20"><DD>
|
|
This sets the <B>publish</B> field in <B>Cargo.toml</B> to the given registry name
|
|
which will restrict publishing only to that registry.
|
|
<P>
|
|
Registry names are defined in
|
|
<I>Cargo config files</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
If not specified, the default registry defined by the <B>registry.default</B>
|
|
config key is used. If the default registry is not set and <B>--registry</B> is not
|
|
used, the <B>publish</B> field will not be set which means that publishing will not
|
|
be restricted.
|
|
</DL>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H3>Display Options</H3>
|
|
|
|
<P>
|
|
<B>-v</B>, <B>--verbose</B>
|
|
<DL COMPACT><DT id="21"><DD>
|
|
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 the <B>term.verbose</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-q</B>, <B>--quiet</B>
|
|
<DL COMPACT><DT id="22"><DD>
|
|
No output printed to stdout.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>--color</B> <I>WHEN</I>
|
|
<DL COMPACT><DT id="23"><DD>
|
|
Control when colored output is used. Valid values:
|
|
<P>
|
|
<DL COMPACT><DT id="24"><DD>
|
|
•
|
|
|
|
|
|
<B>auto</B> (default): Automatically detect if color support is available on the
|
|
terminal.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="25"><DD>
|
|
•
|
|
|
|
|
|
<B>always</B>: Always display colors.
|
|
</DL>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="26"><DD>
|
|
•
|
|
|
|
|
|
<B>never</B>: Never display colors.
|
|
</DL>
|
|
|
|
<P>
|
|
May also be specified with the <B>term.color</B>
|
|
|
|
<I>config value</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/config.html">https://doc.rust-lang.org/cargo/reference/config.html</A>>.
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H3>Common Options</H3>
|
|
|
|
<P>
|
|
<B>+TOOLCHAIN</B>
|
|
<DL COMPACT><DT id="27"><DD>
|
|
If Cargo has been installed with rustup, and the first argument to <B>cargo</B>
|
|
begins with <B>+</B>, it will be interpreted as a rustup toolchain name (such
|
|
as <B>+stable</B> or <B>+nightly</B>).
|
|
See the
|
|
<I>rustup documentation</I> <<A HREF="https://github.com/rust-lang/rustup/">https://github.com/rust-lang/rustup/</A>>
|
|
|
|
for more information about how toolchain overrides work.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-h</B>, <B>--help</B>
|
|
<DL COMPACT><DT id="28"><DD>
|
|
Prints help information.
|
|
</DL>
|
|
|
|
<P>
|
|
<B>-Z</B> <I>FLAG</I>...
|
|
<DL COMPACT><DT id="29"><DD>
|
|
Unstable (nightly-only) flags to Cargo. Run <B>cargo -Z help</B> for
|
|
details.
|
|
</DL>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>ENVIRONMENT</H2>
|
|
|
|
<P>
|
|
See
|
|
<I>the reference</I> <<A HREF="https://doc.rust-lang.org/cargo/reference/environment-variables.html">https://doc.rust-lang.org/cargo/reference/environment-variables.html</A>>
|
|
|
|
for
|
|
details on environment variables that Cargo reads.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>EXIT STATUS</H2>
|
|
|
|
<P>
|
|
0
|
|
<DL COMPACT><DT id="30"><DD>
|
|
Cargo succeeded.
|
|
</DL>
|
|
|
|
<P>
|
|
101
|
|
<DL COMPACT><DT id="31"><DD>
|
|
Cargo failed to complete.
|
|
</DL>
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
<DL COMPACT><DT id="32"><DD>
|
|
1.
|
|
|
|
|
|
Create a binary Cargo package in the current directory:
|
|
<P>
|
|
<DL COMPACT><DT id="33"><DD>
|
|
|
|
<PRE>
|
|
cargo init
|
|
</PRE>
|
|
|
|
</DL>
|
|
|
|
|
|
</DL>
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<P>
|
|
<B><A HREF="/cgi-bin/man/man2html?1+cargo">cargo</A></B>(1), <B><A HREF="/cgi-bin/man/man2html?1+cargo-new">cargo-new</A></B>(1)
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="34"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="35"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="36"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="37"><A HREF="#lbAE">OPTIONS</A><DD>
|
|
<DL>
|
|
<DT id="38"><A HREF="#lbAF">Init Options</A><DD>
|
|
<DT id="39"><A HREF="#lbAG">Display Options</A><DD>
|
|
<DT id="40"><A HREF="#lbAH">Common Options</A><DD>
|
|
</DL>
|
|
<DT id="41"><A HREF="#lbAI">ENVIRONMENT</A><DD>
|
|
<DT id="42"><A HREF="#lbAJ">EXIT STATUS</A><DD>
|
|
<DT id="43"><A HREF="#lbAK">EXAMPLES</A><DD>
|
|
<DT id="44"><A HREF="#lbAL">SEE ALSO</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:08 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|