cargo-init(1)

NAME

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

SYNOPSIS

cargo init [options] [path]

DESCRIPTION

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.

OPTIONS

Init Options

Display Options

Common Options

ENVIRONMENT

See the reference for details on environment variables that Cargo reads.

EXIT STATUS

  • 0: Cargo succeeded.
  • 101: Cargo failed to complete.

EXAMPLES

  1. Create a binary Cargo package in the current directory:

    cargo init
    

SEE ALSO

cargo(1), cargo-new(1)