DocsAutocompleteSchemasOption

Options add additional information to a subcommand. They usually start with - or --.

  • Some options are boolean: they are there or not. These are called flags. e.g. git --verion .
  • Some options take an argument e.g. git commit -m <message>

Properties

name

Type: SingleOrArray\<string>

Required:

Description:

The exact name(s) of the option. It is very important to get this right for parsing purposes. It can be a string or an array of strings. Important: do NOT include an = sign here. Fig handles this logic for you. Including one will mess up the parsing.

Example:

For git commit -m, the option name is ["-m", "--message"]


args

Type: SingleOrArray\<Arg>

Required:

Description:

An array of args or a single arg object.

Important If an option takes an argument, please at least include an empty Arg Object (e.g. {}). If you don't, Fig will assume the option does not take an argument and will present the wrong suggestions.

Example:

git commit -m takes one argument. The most basic representation of this is args: {}


required

Type: boolean

Required:

Description:

Signals whether an option is required. The default is an option is NOT required.

Currently, signalling that an option is required doesn't do anything, however, Fig will handle it in the future

Example:

The "-m" option of git commit is required


exclusive

Type: string[]

Required:

Description:

Signals whether an option is mutually exclusive with other options. Define this as an array of strings of the option names. The default is an option is NOT mutually exclusive with any other options

Currently, signalling mutually exclusive options doesn't do anything in Fig, however, Fig will handle it in the future.

Example:

You might see [-a | --interactive | --patch] in a man page. This means each of these options are mutually exclusive on each other. If we were defining the exclusive prop of the "-a" option, then we would have exclusive: ["--interactive", "--patch"]


dependsOn

Type: string[]

Required:

Description:

Signals whether an option depends other options. Define this as an array of strings of the option names. The default is an option does NOT depend on any other options

Currently, signalling dependsOn doesn't do anything in Fig, however, Fig will handle it in the future.

Example:

In a tool like firebase, we may want to delete a specific extension. The command might be firebase delete --project ABC --extension 123 This would mean we delete the 123 extension from the ABC project. In this case, --extension dependsOn --project


displayName

Type: string

Required:

Description:

See Suggestion

Example:

For the npm CLI we have a subcommand called install. If we wanted to display some custom text like Install an NPM package 📦 we would set name: "install" and displayName: "Install an NPM package 📦"


insertValue

Type: string

Required:

Description:

See Suggestion

Example:

For git commit the -m option has an insert value of -m '{cursor}'


description

Type: string

Required:

Description:

See Suggestion


icon

Type: string

Required:

Description:

See Suggestion

Example:

A, 😊 https://www.herokucdn.com/favicon.ico fig://icon?type=file


isDangerous

Type: boolean

Required:

Description:

See Suggestion

Remark:

This is used in specs like rm and trash.


priority

Type: number

Required:

Description:

See Suggestion

Examples:

If you want your suggestions to always be at the top order regardless of whether they have been selected before or not, rank them 76 or above If you want your suggestions to always be at the bottom regardless of whether they have been selected before or not, rank them 49 or below


hidden

Type: boolean

Required:

Description:

See Suggestion

Example:

The "-" suggestion is hidden in the cd spec. You will only see it if you type cd -

On this page