forc-init

Create a new Forc project in an existing directory

USAGE:

forc init [OPTIONS]

OPTIONS:

--contract

The default program type, excluding all flags or adding this flag creates a basic contract program

-h, --help

Print help information

-L, --log-level <LOG_LEVEL>

Set the log level

--library

Create a package with a library target (src/lib.sw)

--name <NAME>

Set the package name. Defaults to the directory name

--path <PATH>

The directory in which the forc project will be initialized

--predicate

Create a package with a predicate target (src/predicate.rs)

-s, --silent

Silence all output

--script

Create a package with a script target (src/main.sw)

-v, --verbose

Use verbose output

EXAMPLE

$ forc init my-fuel-project
$ cd my-fuel-project
$ tree
.
├── Cargo.toml
├── Forc.toml
├── src
│   └── main.sw
└── tests
    └── harness.rs

Forc.toml is the Forc manifest file, containing information about the project and dependencies. Cargo.toml is the Rust project manifest file, used by the Rust-based tests package.

A src/ directory is created, with a single main.sw Sway file in it.

A tests/ directory is also created. The Cargo.toml in the root directory contains necessary Rust dependencies to enable you to write Rust-based tests using our Rust SDK (fuels-rs). More on this in the Test section down below.