Skip to content

Commit

Permalink
feat: only show forc examples with explicit --help flag (#6013)
Browse files Browse the repository at this point in the history
## Description
closes #6005.

As stated in the issue, executing `forc` prints huge output with
examples etc. This is not ideal because it is very hard to navigate to
list of commands especially with smaller screens. This PR changes the
behavor such that executing just `forc` will print:

```console
Fuel Orchestrator

Usage: forc [OPTIONS] <COMMAND>

Commands:
  addr2line       Show location and context of an opcode address in its source file
  build           Compile the current or target project [aliases: b]
  check           Check the current or target project and all of its dependencies for errors
  clean           Removes the default forc compiler output artifact directory, i.e. `<project-name>/out`
  completions     Generate tab-completion scripts for your shell
  new             Create a new Forc project at `<path>`
  init            Create a new Forc project in an existing directory
  parse-bytecode  Parse bytecode file into a debug format
  test            Run the Sway unit tests for the current project [aliases: t]
  update          Update dependencies in the Forc dependencies directory
  plugins         List all forc plugins
  template        Create a new Forc project from a git template
  contract-id     Determine contract-id for a contract. For workspaces outputs all contract ids in the workspace
  predicate-root  Determine predicate-root for a predicate. For workspaces outputs all predicate roots in the workspace
  help            Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose...             Use verbose output
  -s, --silent                 Silence all output
  -L, --log-level <LOG_LEVEL>  Set the log level
  -h, --help                   Print help (see more with '--help')
  -V, --version                Print version
```

with `--help` flag we still show the examples etc.
  • Loading branch information
kayagokalp authored May 15, 2024
1 parent 8d50370 commit 9a8796b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion forc/src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn help() -> &'static str {
}

#[derive(Debug, Parser)]
#[clap(name = "forc", about = "Fuel Orchestrator", version, after_help = help())]
#[clap(name = "forc", about = "Fuel Orchestrator", version, after_long_help = help())]
struct Opt {
/// The command to run
#[clap(subcommand)]
Expand Down

0 comments on commit 9a8796b

Please sign in to comment.