@salesforce/plugin-command-reference

Generate the Salesforce CLI command reference guide

Usage no npm install needed!

<script type="module">
  import salesforcePluginCommandReference from 'https://cdn.skypack.dev/@salesforce/plugin-command-reference';
</script>

README

@salesforce/plugin-command-reference

Generate the Salesforce CLI command reference guide.

Version Codecov Downloads/week License

First install the plugin.

$ sfdx plugins:install @salesforce/plugin-command-reference

Ensure any plugins are installed that you with to generate documentation for.

$ sfdx update stable-rc

Now we can generate the documentation for all core plug-ins.

$ sfdx commandreference --plugins salesforce-alm,alias,apex,auth,config,custom-metadata,data,limits,org,schema,templates,user,@salesforce/sfdx-plugin-lwc-test,source

Note: Warnings will occur for missing properties in plugins. Those have to be fixed in the plugin itself.

Add to your Salesforce CLI Plugin

To add this to your plugin to catch warning at development time, add it as a dev plugin in the project.json.

"oclif": {
  "devPlugins": [
    "@salesforce/plugin-command-reference"
  ]
}

Then you can run this in your plugin's CI.

./bin/run commandreference --plugins <name-of-your-plugin> --error-on-warnings

Local Development

If you need to make changes to this repository, the easiest thing to do is to link it to your Salesforce CLI. After you cloned this plugin, run the following from this plugin directory:

sfdx plugins:link .

Now, you can install any plugins you want and run the command reference generation on them.

sfdx plugins:install config
sfdx plugins:install alias
sfdx plugins:install auth
sfdx commandreference --plugins alias,config,auth

Commands

sfdx commandreference:generate [-d <string>] [-p <array>] [--hidden] [--erroronwarnings] [--json] [--loglevel trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

generate the command reference guide located

USAGE
  $ sfdx commandreference:generate [-d <string>] [-p <array>] [--hidden] [--erroronwarnings] [--json] [--loglevel
  trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL]

OPTIONS
  -d, --outputdir=outputdir                                                         [default: ./tmp/root] output
                                                                                    directory to put generated files

  -p, --plugins=plugins                                                             comma separated list of plugin names
                                                                                    to be part of the generation.
                                                                                    Defaults to the oclif plugin in the
                                                                                    current working directory

  --erroronwarnings                                                                 fail the command if there are any
                                                                                    warnings

  --hidden                                                                          show hidden commands

  --json                                                                            format output as json

  --loglevel=(trace|debug|info|warn|error|fatal|TRACE|DEBUG|INFO|WARN|ERROR|FATAL)  [default: warn] logging level for
                                                                                    this command invocation

See code: src/commands/commandreference/generate.ts