dev generate command

Generate a new sf command.

Description for dev generate command 

You must run this command from within a plugin directory, such as the directory created with the “sf dev generate plugin” command.

The command generates basic source files, messages (*.md), and test files for your new command. The Typescript files contain import statements for the minimum required Salesforce libraries, and scaffold some basic code. The new type names come from the value you passed to the –name flag.

The command updates the package.json file, so if it detects conflicts with the existing file, you’re prompted whether you want to overwrite the file. There are a number of package.json updates required for a new command, so we recommend you answer “y” so the command takes care of them all. If you answer “n”, you must update the package.json file manually.

Flags 

Flag Name (Long)Flag Name (Short)Description
‑‑dry‑runN/AType: Boolean

Display the changes that would be made without writing them to disk.
‑‑flags‑dirN/AType: Value

Import flag values from a directory.
‑‑forceN/AType: Boolean

Overwrite existing files.
‑‑name‑nType: Value
Required

Name of the new command. Use colons to separate the topic and command names.
‑‑nutsN/AType: Boolean
Default value: true

Generate a NUT test file for the command.
‑‑unitN/AType: Boolean
Default value: true

Generate a unit test file for the command.

Examples for dev generate command 

Generate the files for a new “sf my exciting command”:

1sf dev generate command --name my:exciting:command