Icon Linkforc-init

Create a new Forc project in an existing directory

Icon LinkUSAGE:

forc init [OPTIONS]

Icon LinkOPTIONS:

--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

-V, --version

Print version information

--workspace

Adding this flag creates an empty workspace

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.