sfdx plugins:install email@example.com
Please report any issues at https://github.com/forcedotcom/cli/issues
- Please read our Code of Conduct
- Create a new issue before starting your project so that we can keep track of what you are trying to add/fix. That way, we can also offer suggestions or let you know if there is already an effort in progress.
- Fork this repository.
- Build the plugin locally
- Create a topic branch in your fork. Note, this step is recommended but technically not required if contributing using a fork.
- Edit the code in your fork.
- Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests.
- Sign CLA (see CLA below).
- Send us a pull request when you are done. We'll review your code, suggest any needed changes, and merge it in.
External contributors will be required to sign a Contributor's License Agreement. You can do so by going to https://cla.salesforce.com/sign-cla.
To build the plugin locally, make sure to have yarn installed and run the following commands:
# Clone the repository git clone firstname.lastname@example.org:salesforcecli/plugin-env # Install the dependencies and compile yarn install yarn build
To use your plugin, run using the local
# Run using local run file. ./bin/run env
There should be no differences when running via the Salesforce CLI or using the local run file. However, it can be useful to link the plugin to do some additional testing or run your commands from anywhere on your machine.
# Link your plugin to the sfdx cli sfdx plugins:link . # To verify sfdx plugins
sf env display
Specify an environment with either the username you used when you logged into the environment with "sf login", or the alias you gave the environment when you created it. Run "sf env list" to view all your environments and their aliases.
USAGE $ sf env display [--json] [-e <value>] FLAGS -e, --target-env=<value> Environment alias or login user. GLOBAL FLAGS --json Format output as json. DESCRIPTION Display details about an environment. Specify an environment with either the username you used when you logged into the environment with "sf login", or the alias you gave the environment when you created it. Run "sf env list" to view all your environments and their aliases. Output depends on the type of environment. For example, scratch org details include the access token, alias, username of the associated Dev Hub, the creation and expiration date, the generated scratch org username, and more. Compute environment details include the alias, connected orgs, creation date, project name, and more. EXAMPLES Display details about a scratch org with alias my-scratch-org: $ sf env display --target-env=my-scratch-org Specify a username instead of an alias: $ sf env display --email@example.com Specify JSON format and redirect output into a file: $ sf env display --target-env=my-scratch-org --json > tmp/MyOrdDesc.json
sf env list
By default, the command displays active environments. For orgs, active means unexpired scratch orgs and orgs you’re currently logged into.
USAGE $ sf env list [--json] [-a] [--columns <value>] [--csv] [--filter <value>] [--no-header] [--no-truncate] [--output csv|json|yaml] [--sort <value>] FLAGS -a, --all Show all environments, even inactive ones. --columns=<value>... List of columns to display. --csv Output in csv format [alias: --output=csv] --filter=<value> Filter property by partial string matching. --no-header Hide table header from output. --no-truncate Don't truncate output to fit screen. --output=<option> Format in which to display the output. <options: csv|json|yaml> --sort=<value> Column to sort by (prepend '-' for descending). GLOBAL FLAGS --json Format output as json. DESCRIPTION List the environments you’ve created or logged into. By default, the command displays active environments. For orgs, active means unexpired scratch orgs and orgs you’re currently logged into. Output is displayed in multiple tables, one for each environment type. For example, the Salesforce Orgs table lists the non-scratch orgs you’re logged into, such as sandboxes, Dev Hubs, production orgs, and so on. Scratch orgs and compute environments get their own tables. The two org tables show similar information, such as aliases, information about the org, and how you authorized (logged into) it, such as with a web browser or JWT. The scratch org table also shows the expiration date. For non-scratch orgs, the Username column refers to the user you logged into the org with. For scratch orgs it refers to the username that was generated for you when you created the scratch org. Your default scratch org or Dev Hub org is indicated with the "target-org" or "target-dev-hub" configuration variable, respectively, in the Config column. The compute environment table shows the alias, information about the connected orgs, the project name, and more. Use the table manipulation flags, such as --filter and --sort, to change how the data is displayed. Run "sf env display" to view details about a specific environment. EXAMPLES List all active environments: $ sf env list List both active and inactive environments: $ sf env list --all Filter the output to list only orgs you authorized using a web browser; "Auth Method" is the name of a column: $ sf env list --filter "Auth Method=web" Display only the Aliases column and sort the aliases in descending order: $ sf env list --sort "-Aliases" --columns "Aliases" Don't truncate the displayed output and instead wrap text that's wider than your terminal: $ sf env list --no-truncate Display only the table data, not the headers, in comma-separated value (csv) format: $ sf env list --csv --no-header
sf env open
You can open the following types of environments in a web browser: scratch orgs, sandboxes, Dev Hubs, and production orgs. Run "sf env list" to view your environments and their aliases and login usernames.
USAGE $ sf env open [--json] [-p <value>] [-r] [-e <value>] [--browser <value>] FLAGS -e, --target-env=<value> Login user or alias of the environment to open. -p, --path=<value> Path to append to the end of the login URL. -r, --url-only Display the URL, but don’t launch it in a browser. --browser=<value> Browser in which to open the environment. GLOBAL FLAGS --json Format output as json. DESCRIPTION Open an environment in a web browser. You can open the following types of environments in a web browser: scratch orgs, sandboxes, Dev Hubs, and production orgs. Run "sf env list" to view your environments and their aliases and login usernames. Each of your environments is associated with an instance URL, such as https://login.salesforce.com. To open a specific web page, specify the portion of the URL after "<URL>/" with the --path flag, such as /apex/YourPage to open a Visualforce page. EXAMPLES Open the Visualforce page /apex/StartHere in a scratch org with alias test-org: $ sf env open --target-env test-org --path /apex/StartHere View the URL but don't launch it in a browser: $ sf env open --target-env test-org --path /apex/StartHere --url-only Open the environment in the Google Chrome browser: $ sf env open --target-env test-org --path /apex/StartHere --browser chrome FLAG DESCRIPTIONS -e, --target-env=<value> Login user or alias of the environment to open. Specify the login user or alias that’s associated with the environment. For scratch orgs, the login user is generated by the command that created the scratch org. You can also set an alias for the scratch org when you create it. For Dev Hubs, sandboxes, and production orgs, specify the alias you set when you logged into the org with "sf login". --browser=<value> Browser in which to open the environment. You can specify that the environment open in one of the following browsers: Firefox, Safari, Google Chrome, or Windows Edge. If you don’t specify --browser, the environment opens in your default browser. The exact names of the browser applications differ depending on the operating system you're on; check your documentation for details.