Skip to content

Instantly share code, notes, and snippets.

@cgjosephlee
Last active December 19, 2018 09:44
Show Gist options
  • Save cgjosephlee/69bfd32a39dad7c5a6fab10c0551806f to your computer and use it in GitHub Desktop.
Save cgjosephlee/69bfd32a39dad7c5a6fab10c0551806f to your computer and use it in GitHub Desktop.
A simple bash theme
#!/usr/bin/env bash
SCM_THEME_PROMPT_PREFIX="${bold_cyan} (${bold_green}"
SCM_THEME_PROMPT_SUFFIX="${bold_cyan})"
SCM_THEME_PROMPT_DIRTY=" ${bold_red}✗"
SCM_THEME_PROMPT_CLEAN=" ${bold_green}✓"
__last_cmd_return() {
code=$?
if [ $code = 0 ]; then
echo "${bold_green}"
elif [ $code != 0 ]; then
echo "${bold_red}${code} "
fi
}
prompt() {
local LAST_CMD_RETURN=$(__last_cmd_return)
PS1="${LAST_CMD_RETURN}➜ ${bold_blue}\W$(scm_prompt_info)${reset_color}${normal} "
}
safe_append_prompt_command prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment