Salesforce CLI Command Reference
Release Notes
Deprecation Policy
dev audit messages
dev convert messages
dev convert script
dev generate command
dev generate flag
dev generate plugin
Generate a new sf 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.
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑dry‑run | N/A | Type: Boolean Display the changes that would be made without writing them to disk. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑force | N/A | Type: Boolean Overwrite existing files. |
‑‑name | ‑n | Type: Value Required Name of the new command. Use colons to separate the topic and command names. |
‑‑nuts | N/A | Type: Boolean Default value: trueGenerate a NUT test file for the command. |
‑‑unit | N/A | Type: Boolean Default value: trueGenerate a unit test file for the command. |
Generate the files for a new “sf my exciting command”:
1sf dev generate command --name my:exciting:command