Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docs for autocompletions and forc init template #899

Merged
merged 6 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/src/getting-started/forc_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ forc json-abi > my-contract-abi.json
There is currently not a convention for where ABI files should be placed; one
common choice is loose in the root directory.

## Initializing a new Sway Project from a Template

Pass the `--template` flag to `forc init` to create a new project using one of the provided templates. Currently, only the `counter` example is available. More templates will be available in the future.

```console
forc init --template counter my_sway_project
```

## Testing a Sway Project with Forc

If you look again at the project structure when you create a new Forc project, you can see a directory called `tests/`:
Expand Down
26 changes: 26 additions & 0 deletions docs/src/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,29 @@ cargo install forc fuel-core
The Sway toolchain can be built from source by following instructions at <https://github.com/FuelLabs/sway>.

The Fuel Core full node implementation can be built from source by following instructions at <https://github.com/FuelLabs/fuel-core>.

## Enable tab completion for Bash, Fish, Zsh, or PowerShell

`forc` now supports generating completion scripts for Bash, Fish, Zsh, and PowerShell. See `forc completions --help` for full details, but the gist is as simple as using one of the following:

```
# Bash
$ forc completions --shell=bash > ~/.local/share/bash-completion/completions/forc

# Bash (macOS/Homebrew)
$ forc completions --shell=bash > $(brew --prefix)/etc/bash_completion.d/forc.bash-completion

# Fish
$ mkdir -p ~/.config/fish/completions
$ forc completions --shell=fish > ~/.config/fish/completions/forc.fish

# Zsh
$ forc completions --shell=zsh > ~/.zfunc/_forc

# PowerShell v5.0+
$ forc completions --shell=powershell >> $PROFILE.CurrentUserCurrentHost
# or
$ forc completions --shell=powershell | Out-String | Invoke-Expression
```

Once the completions have been generated and properly installed, close and reopen your terminal for the new completions to take effect.