cargo-init --- Create a new Cargo package in an existing directory
cargo init
[options] [path]
This command will create a new Cargo manifest in the current directory. Give a path as an argument to create in the given directory.
If there are typically-named Rust source files already in the directory, those will be used. If not, then a sample src/main.rs
file will be created, or src/lib.rs
if --lib
is passed.
If the directory is not already in a VCS repository, then a new repository is created (see --vcs
below).
See cargo-new(1) for a similar command which will create a new package in a new directory.
See the reference for details on environment variables that Cargo reads.
0
: Cargo succeeded.101
: Cargo failed to complete.Create a binary Cargo package in the current directory:
cargo init