Commands and Topics
The standard grammatical structure for an sf
command is:
<topic> <action> <resource | sub-action> [flags]
Each of these taxonomic elements has its own rules, but in all cases, the most important rule is that the command structure feels consistent. If necessary, break other rules to achieve the goal of consistency.
The top-level topic is a collection or “bucket” of commands within Salesforce CLI. Topics are nouns that focus on a single Salesforce product, concept, or feature. We recommend you use the most specific noun possible to cover the anticipated scope of your plugin, although it's not required.
Command examples:
sf org login web --set-default-dev-hub
sf apex generate class --name MyClass --output-dir force-app/main/default/classes
sf project deploy start --metadata ApexClass
- Topics are Nouns.
- Be specific. Topic name should be unique and concise. Topics are often a company or product name.
- Avoid acronyms unless they're commonly known industry-standard terms.
- Hyphenate the topic (no camel case or spaces).
- Use the singular version of the topic as the default when possible.
- If you need or want both singular and plural topics, add the plural as an alias.
- Topic and command names are lowercase.
apex
[Salesforce Feature]lightning
[Salesforce Feature]org
[Salesforce Feature and common Salesforce term]project
[Salesforce Feature and common Salesforce term]slack
[Salesforce Product]heroku
[Salesforce Product]
cmdt
[Salesforce Feature]- cmdt is an exception, because while it's not an industry-standard acronym, the Salesforce Community recognizes it as an acronym for Custom Metadata Type.
tsm
(Tableau Service Manager)tsm is not an non-industry standard acronym. It doesn't rise to the level of a Salesforce Community recognized term or acronym so as to be an exception.
analytics
Analytics is too generic and will overlap with other analytics services on the Salesforce platform. A better example is
crm-analytics
, which specific.scanner
“Scan” refers to a broad set of actions in the software industry and isn't specific enough for a top-level command topic. A better example is
code-analyzer
which references the Salesforce product name.