Module: SfCli::Sf::Org::List
- Included in:
- Core
- Defined in:
- lib/sf_cli/sf/org/list.rb
Defined Under Namespace
Classes: OrgConfig
Instance Method Summary collapse
-
#list ⇒ Object
List orgs you’ve created or authenticated to.
Instance Method Details
#list ⇒ Object
List orgs you’ve created or authenticated to
org_config_list = sf.org.list # returns a list of OrgConfig
OrgConfig object has a org information including security sensitive things such as access token, username and so on.
It also has some methods to identify its org type:
-
devhub?
-
sandbox?
-
scratch?
-
default?
-
default_devhub?
and you can check the org connected like this:
org_config_list = sf.org.list # returns a list of OrgConfig
org_config.first.conncected?
For more command details, see the command reference
52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/sf_cli/sf/org/list.rb', line 52 def list flags = { # reserved for later option addition } json = exec(__method__, flags: flags, redirection: :null_stderr) others = json['result']['other'].map{|config| OrgConfig.new(**config)} sandboxes = json['result']['sandboxes'].map{|config| OrgConfig.new(**config)} non_scratch_orgs = json['result']['nonScratchOrgs'].map{|config| OrgConfig.new(**config)} devhubs = json['result']['devHubs'].map{|config| OrgConfig.new(**config)} scratch_orgs = json['result']['scratchOrgs'].map{|config| OrgConfig.new(**config)} (others + sandboxes + non_scratch_orgs + devhubs + scratch_orgs).uniq{|config| config.alias} end |