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 flag for an existing command.
You must run this command from within a plugin directory, such as the directory created with the “sf dev generate plugin” command.
This command is interactive. It first discovers all the commands currently implemented in the plugin, and asks you which you want to create a new flag for. It then prompts for other flag properties, such as its long name, optional short name, type, whether it’s required, and so on. Long flag names must be kebab-case and not camelCase. The command doesn’t let you use an existing long or short flag name. When the command completes, the Typescript file for the command is updated with the code for the new flag.
Use the –dry-run flag to review new code for the command file without actually updating it.
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑dry‑run | ‑d | Type: Boolean Print new flag code instead of adding it to the command file. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
Generate a new flag and update the command file:
1sf dev generate flagDon’t actually update the command file, just view the generated code:
1sf dev generate flag --dry-run