Last active
February 11, 2020 00:06
-
-
Save wadewegner/9709ffa87b71c5821174e02fda8e8f82 to your computer and use it in GitHub Desktop.
My ZSH theme that includes some stuff for SFDX
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
# wadewegner.zsh-theme | |
prompt_fn() { | |
config="$(cat .sfdx/sfdx-config.json 2> /dev/null)"; | |
globalConfig="$(cat ~/.sfdx/sfdx-config.json)"; | |
defaultusername="$(echo ${config} | jq -r .defaultusername)" | |
defaultdevhubusername="$(echo ${config} | jq -r .defaultdevhubusername)" | |
globaldefaultusername="$(echo ${globalConfig} | jq -r .defaultusername)" | |
globaldefaultdevhubusername="$(echo ${globalConfig} | jq -r .defaultdevhubusername)" | |
username=$globaldefaultusername | |
if [ ! $defaultusername = "null" ] | |
then | |
username=$defaultusername | |
fi | |
devhub=$globaldefaultdevhubusername | |
if [ ! $defaultdevhubusername = "null" ] | |
then | |
devhub=$defaultdevhubusername | |
fi | |
prompt="%{$fg[blue]%}d:%{$reset_color%} $devhub, %{$fg[blue]%}u:%{$reset_color%} $username" | |
echo $prompt | |
} | |
PROMPT='%{$fg_bold[green]%}%~%{$reset_color%} %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%}% %{$reset_color%}%{$fg[red]%}❯%{$reset_color%} ' | |
ZSH_THEME_GIT_PROMPT_PREFIX="±(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%} " | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) " | |
RPROMPT='$(prompt_fn)' |
Nevermind, I see that you're reading it from the sfdx-config.json, so that property doesn't exist in that file.
Cool functionality, nevertheless.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Question... instead of displaying defaultdevhumusername, could it be the alias? What would I have to change in lines 9 and 11?