Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Nightly /
Forc Init

Icon LinkCreate

Usage: forc init [OPTIONS]

Options:

--path <PATH>

The directory in which the forc project will be initialized

--contract

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

--script

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

--predicate

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

--library

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

--workspace

Adding this flag creates an empty workspace

--name <NAME>

Set the package name. Defaults to the directory name

-v, --verbose...

Use verbose output

-s, --silent

Silence all output

-L, --log-level <LOG_LEVEL>

Set the log level

-h, --help

Print help

-V, --version

Print version

EXAMPLES:

Icon LinkInitialize a new Forc project

forc init --path

Icon LinkInitialize a new Forc project as workspace

forc init --path --workspace

Icon LinkInitialize a new Forc project with a predicate

forc init --path --predicate

Icon LinkInitialize a new Forc library project

forc init --path --library

Icon LinkEXAMPLE

$ mkdir my-fuel-project
$ cd my-fuel-project
$ forc init
$ tree
.
├── Forc.toml
└── src
    └── main.sw

Forc.toml is the Forc manifest file, containing information about the project and dependencies.

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