hardis:org:select
Description
Command Behavior
Allows you to select a Salesforce org and set it as your default, optionally filtering by Dev Hub or scratch orgs.
This command simplifies switching between different Salesforce environments. It presents an interactive list of your authenticated orgs, enabling you to quickly set a new default org for subsequent Salesforce CLI commands.
Key functionalities:
- Interactive Org Selection: Displays a list of your authenticated Salesforce orgs, allowing you to choose one.
- Default Org Setting: Sets the selected org as the default for your Salesforce CLI environment.
- Dev Hub Filtering: The
--devhubflag filters the list to show only Dev Hub orgs. - Scratch Org Filtering: The
--scratchflag filters the list to show only scratch orgs related to your default Dev Hub. - Connection Verification: Ensures that the selected org is connected and prompts for re-authentication if necessary.
Technical explanations
The command's technical implementation involves:
- Interactive Org Prompt: Uses the
promptOrgutility to display a list of available Salesforce orgs and allows the user to select one. It passes thedevHubandscratchflags topromptOrgto filter the displayed list. - Default Org Configuration: The
promptOrgutility (internally) handles setting the selected org as the default using Salesforce CLI's configuration mechanisms. - Connection Check: It calls
makeSureOrgIsConnectedto verify the connection status of the selected org and guides the user to re-authenticate if the org is not connected. - Salesforce CLI Integration: It leverages Salesforce CLI's underlying commands for org listing and authentication.
Parameters
| Name | Type | Description | Default | Required | Options |
|---|---|---|---|---|---|
| debug -d |
boolean | Activate debug mode (more logs) | |||
| devhub -h |
boolean | Also connect associated DevHub | |||
| flags-dir | option | undefined | |||
| json | boolean | Format output as json. | |||
| prompt-default -e |
boolean | Prompt to set the selected org as default | |||
| scratch -s |
boolean | Select scratch org related to default DevHub | |||
| skipauth | boolean | Skip authentication check when a default username is required | |||
| username -t |
option | Username of the org you want to authenticate (overrides the interactive prompt) | |||
| websocket | option | Websocket host:port for VsCode SFDX Hardis UI integration |
Examples
$ sf hardis:org:select