Skip to content

Instantly share code, notes, and snippets.

@GianpaMX
Created January 15, 2020 16:24
Show Gist options
  • Save GianpaMX/a95123e5307697293aed1657c72dbdc1 to your computer and use it in GitHub Desktop.
Save GianpaMX/a95123e5307697293aed1657c72dbdc1 to your computer and use it in GitHub Desktop.
Android Dev Env
$ cat .bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/bin:${PATH}"
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
export ANDROID_HOME="/usr/local/share/android-sdk"
export ANDROID_NDK="$ANDROID_HOME/ndk-bundle"
export ANDROID_NDK_REPOSITORY="$ANDROID_HOME/ndk-bundle"
export PATH="${PATH}:$ANDROID_HOME/build-tools"
export PATH="${PATH}:$ANDROID_HOME/platform-tools"
export PATH="${PATH}:$ANDROID_HOME/tools/bin"
export PATH="${PATH}:$ANDROID_HOME/tools"
export PATH="${PATH}:$ANDROID_HOME/$ANDROID_NDK"
source ~/.git-prompt.sh
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
# curl
export PATH="/usr/local/opt/curl/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/curl/lib"
export CPPFLAGS="-I/usr/local/opt/curl/include"
# Git CLI integration
# * uncommitted changes
# ^ stashed changes
# > ahead of origin
# < behind origin
# ? diverged from origin
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_stash {
[[ $(git stash list 2> /dev/null | tail -n1) != "" ]] && echo "^"
}
function parse_git_ahead {
[[ -n $(git status 2> /dev/null | grep 'Your branch is ahead of') ]] && echo ">"
}
function parse_git_behind {
[[ -n $(git status 2> /dev/null | grep 'Your branch is behind') ]] && echo "<"
}
function parse_git_diverge {
[[ -n $(git status 2> /dev/null | grep 'have diverged') ]] && echo "?"
}
function current_git_branch {
git rev-parse --abbrev-ref HEAD 2> /dev/null
}
function current_git_branch_with_markers {
if [ -d ".git" ]; then
git rev-parse --abbrev-ref HEAD 2> /dev/null | sed -e "s/\(.*\)/\1$(parse_git_stash)$(parse_git_ahead)$(parse_git_behind)$(parse_git_diverge)$(parse_git_dirty)/"
fi
}
function set_prompt {
local YELLOW='\[\e[0;33m\]'
local HVIOLET='\[\e[1;35m\]'
local BLUE='\[\e[0;34m\]'
local NORMAL='\[\e[0m\]'
# PS1="$YELLOW\w $HVIOLET(\$(current_git_branch_with_markers))$BLUE$ $NORMAL"
PS1="$NORMAL\w $BLUE\$(current_git_branch_with_markers)$ $NORMAL"
}
set_prompt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment