Skip to content

Instantly share code, notes, and snippets.

@Keyes
Last active August 28, 2018 06:20

Revisions

  1. Keyes revised this gist Aug 28, 2018. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -19,9 +19,9 @@ export CLICOLOR=1
    export LSCOLORS=GxBxCxDxexegedabagaced

    parse_git_branch() {
    STR="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1/')"

    if [ $(git rev-parse --is-inside-work-tree) ]; then
    if [ $(git rev-parse --is-inside-work-tree 2> /dev/null) ]; then
    STR="$(git branch | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1/')"
    if [[ ! $( git status --porcelain) ]]; then
    STR+=" ✓)"
    else
  2. Keyes revised this gist Aug 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .bash_profile
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ export LSCOLORS=GxBxCxDxexegedabagaced
    parse_git_branch() {
    STR="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1/')"

    if [ -d .git ]; then
    if [ $(git rev-parse --is-inside-work-tree) ]; then
    if [[ ! $( git status --porcelain) ]]; then
    STR+=" ✓)"
    else
  3. Keyes revised this gist Aug 27, 2018. 1 changed file with 22 additions and 1 deletion.
    23 changes: 22 additions & 1 deletion .bash_profile
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,35 @@
    export NVM_DIR="$HOME/.nvm"
    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm

    export NODE_ENV=development

    alias l="ls -lisa"
    alias gs="grunt serve"
    alias gb="grunt build"
    alias clone="git clone $1 $2"
    alias branch="git branch $1 $2 $3"

    gpush() {
    git add . &&
    git commit -m "$1" &&
    git push;
    }

    export CLICOLOR=1
    export LSCOLORS=GxBxCxDxexegedabagaced

    parse_git_branch() {
    echo "$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')"
    STR="$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1/')"

    if [ -d .git ]; then
    if [[ ! $( git status --porcelain) ]]; then
    STR+=" ✓)"
    else
    STR+=" *)"
    fi
    fi

    echo -e "$STR"
    }

    get_packagename() {
  4. Keyes created this gist Sep 11, 2017.
    48 changes: 48 additions & 0 deletions .bash_profile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    alias l="ls -lisa"
    alias gs="grunt serve"
    alias gb="grunt build"
    alias clone="git clone $1 $2"
    alias branch="git branch $1 $2 $3"

    export CLICOLOR=1
    export LSCOLORS=GxBxCxDxexegedabagaced

    parse_git_branch() {
    echo "$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/')"
    }

    get_packagename() {
    echo "$(grep '"name"' ./package.json | grep -o ': ".*"' | cut -d \" -f 2)"
    }

    get_packageversion() {
    echo "$(grep '"version"' ./package.json | grep -o ': ".*"' | cut -d \" -f 2)"
    }

    get_nodepackage() {
    STR=""

    if [ -e "./package.json" ]; then
    STR+="\033[1;31m"

    if [ $(get_packagename) ]; then
    STR+=$(get_packagename)
    fi

    if [[ $(get_packagename) && $(get_packageversion) ]]; then
    STR+="@"
    fi

    if [ $(get_packageversion) ]; then
    STR+=$(get_packageversion)
    fi

    STR+=" "
    fi

    STR+="\033[0;32m[$(echo "$(node -v)")]"

    echo -e $STR
    }

    export PS1="\$(get_nodepackage)\033[0;33m\$(parse_git_branch) \e[1;34m\w \e[0m$ "