Created
April 13, 2017 17:01
-
-
Save jstvz/3d2725eb565aac09bcd1a9aa02482805 to your computer and use it in GitHub Desktop.
Powerlevel9k SFDX default username Prompt
This file contains hidden or 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
| # the correct way, but slow | |
| #sfdx_prompt(){ | |
| # local sfdx_default="$(sfdx force:config:list | grep defaultusername | awk '{print $2}')" | |
| # if [[ -n "$sfdx_default" ]]; then | |
| # echo -n " $sfdx_default" | |
| # fi | |
| #} | |
| # the fast way, but incorrect | |
| sfdx_prompt(){ | |
| local config="$(cat .sfdx/sfdx-config.json 2> /dev/null)"; | |
| local sfdx_default="$(echo ${config} | jq -r .defaultusername)" | |
| if [[ -n "$sfdx_default" && "$sfdx_default" != "null" ]]; then | |
| echo -n " $sfdx_default" | |
| fi | |
| } | |
| POWERLEVEL9K_CUSTOM_SFDX_DEFAULT="sfdx_prompt" | |
| POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(virtualenv pyenv custom_sfdx_default time) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment