Created
July 28, 2017 17:02
-
-
Save dcarroll/032965d8164fef51c879536486bf68da to your computer and use it in GitHub Desktop.
Simple script to check if the org you are using is a Dev Hub. Run by passing a username or alias to the script.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# specify your username or alias | |
usernameOrAlias=$1 | |
hub=$(sfdx force:data:soql:query -q "SELECT DurableId, SettingValue FROM OrganizationSettingsDetail WHERE SettingName = 'ScratchOrgManagementPref'" -t -u ${usernameOrAlias} --json) | |
# parse response | |
size="$(echo ${hub} | jq -r .result.size)" | |
if [[ $size -eq 0 ]]; | |
then | |
echo "${usernameOrAlias} is not a dev hub" | |
exit 0 | |
fi | |
records="$(echo ${hub} | jq -r .result.records)" | |
value="$(echo ${records} | jq -r .[].SettingValue)" | |
# evaluate the setting value | |
if $value === 'true' | |
then | |
echo "${usernameOrAlias} is a dev hub" | |
else | |
echo "${usernameOrAlias} is not a dev hub" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment