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 |
|---|---|---|
| <code>‑‑dry‑run</code> | N/A | Type: Boolean<br><br>Display the changes that would be made without writing them to disk. |
| <code>‑‑flags‑dir</code> | N/A | Type: Value<br><br>Import flag values from a directory. |
| <code>‑‑force</code> | N/A | Type: Boolean<br><br>Overwrite existing files. |
| <code>‑‑name</code> | <code>‑n</code> | Type: Value<br>Required<br><br>Name of the new command. Use colons to separate the topic and command names. |
| <code>‑‑nuts</code> | N/A | Type: Boolean<br>Default value: true<br><br>Generate a NUT test file for the command. |
| <code>‑‑unit</code> | N/A | Type: Boolean<br>Default value: true<br><br>Generate a unit test file for the command. |
Examples for dev generate command
Generate the files for a new "sf my exciting command":
sf dev generate command --name my:exciting:command
<!-- prettier-ignore-end -->