Skip to content

Instantly share code, notes, and snippets.

@dcarroll
Last active May 15, 2021 18:06
Show Gist options
  • Save dcarroll/6b0b243c7bc4641e73da9bb77552e67d to your computer and use it in GitHub Desktop.
Save dcarroll/6b0b243c7bc4641e73da9bb77552e67d to your computer and use it in GitHub Desktop.
This is the bash profile that I use. You will see some things commented out and some experiments. Feel free to remove those, build on them, whatever you want to do. Make sure you look as the path exporting section as you system may have different paths.
# dx customizations
alias status='(sfdx force:org:list &
sfdx force:alias:list &
sfdx force:config:list; wait)'
alias orglist='sfdx force:org:list'
alias orglistc='sfdx force:org:list --clean -p'
alias push='sfdx force:source:push'
alias pull='sfdx force:source:pull'
user() {
#do things with parameters like $1 such as
sfdx force:config:set defaultusername=$1
}
orgdel() {
if [ "$#" = 0 ]; then
echo "You will need to pass an alias or userid to this command."
return 1
fi
if [ "$#" = 1 ]; then
sfdx force:org:delete -p -u $1
else
#list all the orgs to a file and then find the ones passed to the function and delete them
sfdx force:org:list --json > orglist.json
(for row in $(jq -r .result.scratchOrgs[].alias < orglist.json); do
for item in $@; do
if [ $item = $row ]; then
sfdx force:org:delete -p -u $item &
fi
done
printf ""
done
wait)
rm -rf orglist.json
fi
return 0
}
setpassword() {
sfdx force:user:password:generate -u $1
}
clone() {
git clone https://github.com/$1
}
orgopen() {
#check to see if argument(s) were passed, if not just open the default
if [ -z "$1" ]; then
sfdx force:org:open -p
else
sfdx force:org:open -u $1
fi
return 0
}
alias reload='source ~/.bash_profile'
# Get your current public IP
alias ip='curl icanhazip.com'
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
bldgrn='\e[1;32m' # Green
bldylw='\e[1;33m' # Yellow
bldblu='\e[1;34m' # Blue
bldpur='\e[1;35m' # Purple
bldcyn='\e[1;36m' # Cyan
bldwht='\e[1;37m' # White
unkblk='\e[4;30m' # Black - Underline
undred='\e[4;31m' # Red
undgrn='\e[4;32m' # Green
undylw='\e[4;33m' # Yellow
undblu='\e[4;34m' # Blue
undpur='\e[4;35m' # Purple
undcyn='\e[4;36m' # Cyan
undwht='\e[4;37m' # White
bakblk='\e[40m' # Black - Background
bakred='\e[41m' # Red
badgrn='\e[42m' # Green
bakylw='\e[43m' # Yellow
bakblu='\e[44m' # Blue
bakpur='\e[45m' # Purple
bakcyn='\e[46m' # Cyan
bakwht='\e[47m' # White
txtrst='\e[0m' # Text Reset
# Git branch in prompt.
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/git:(\1)/'
}
print_before_the_prompt () {
printf "\n$txtred%s: $bldgrn%s $txtpur%s $txtcyn%s\n$txtrst" "$USER" "$PWD" "$(parse_git_branch)"
}
PROMPT_COMMAND=print_before_the_prompt
PS1='-> '
@patmcclellan
Copy link

thanks for sharing. Some other aliases that I use (and added to my version of your file)
alias sopen='sfdx force:org:open -u'
alias sauth='sfdx force:auth:web:login -a'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment