Skip to content

Instantly share code, notes, and snippets.

@sjurgis
Last active July 1, 2021 23:03
Show Gist options
  • Save sjurgis/2d080a9ae6bfbf1f68d40d13db6f4daf to your computer and use it in GitHub Desktop.
Save sjurgis/2d080a9ae6bfbf1f68d40d13db6f4daf to your computer and use it in GitHub Desktop.
list of sfdx aliases (zsh)
# Push source, notify when done
alias dxp='sfdx force:source:push && osascript -e "display notification \"Push completed\""'
# Get an org list and show custom fields (devhub, instance URL)
alias dxl="sfdx force:org:list --verbose --json --skipconnectionstatus | jq -r '.result.scratchOrgs[] | [.defaultMarker, .alias, .username, .devHubUsername, .instanceUrl] | @tsv'"
# Set default username
dxd() { sfdx force:config:set defaultusername=$1 }
# Get tail of logs also while logging everything into file
alias dxtail="sfdx force:apex:log:tail | tee ../dxtail.log"
# Get tail of logs but only display System.debug (no multiline tho), exceptions or start of class
alias dxtaild="sfdx force:apex:log:tail --loglevel debug | grep -o 'USER_DEBUG.*\|EXCEPTION_THROWN.*\|CODE_UNIT_STARTED.*' --color=never"
# Delete org by username
alias dxrm='sfdx force:org:delete -p -u '
# Run apex tests, but prevent mac from sleep and notify when done
dxtest(){
caffeinate sfdx force:apex:test:run -r human -c -w 20
osascript -e "display notification \"Apex tests completed\""
}
# Get org login url, default or by username
dxo(){
if [ -z $1 ]
then
sfdx force:org:open -r --json | jq -r .result.url
else
sfdx force:org:open -r -u $1 --json | jq -r .result.url
fi
}
# Delete logs
alias dxcl='echo "delete [select id from MyNS__Logs__c limit 10000];" | sfdx force:apex:execute'
# Enable lightning debug mode
alias dxdb='echo "update new User(Id = UserInfo.getUserId(), UserPreferencesUserDebugModePref=true);" | sfdx force:apex:execute'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment