5 [[ -f "$XDG_STATE_HOME/bash/bashrc_temp" ]] && . $XDG_STATE_HOME/bash/bashrc_temp
7 if [ -n "$HOME/.local/bin" ]; then
8 PATH="$HOME/.local/bin:$PATH"
11 # If not running interactively, don't do anything
12 [[ $- != *i* ]] && return
15 export HISTFILE="$XDG_STATE_HOME/bash/history"
18 alias ls='ls --color=auto -F -T 0'
19 alias tmux='tmux -f $XDG_CONFIG_HOME/tmux/tmux.conf'
21 alias grep='grep --color=auto'
22 alias fgrep='fgrep --color=auto'
23 alias egrep='egrep --color=auto'
29 alias psp="pstree -aUp $USER"
30 alias dotdrop="dotdrop --cfg $XDG_CONFIG_HOME/dotdrop/config.yaml"
32 [[ -f /usr/share/stgit/completion/stgit-completion.bash ]] && . /usr/share/stgit/completion/stgit-completion.bash
34 {% if role.get(profile) == "fretlink" %}
35 ##### Some Fretlink aliases
36 alias getDump='s3cmd -c <(pass show Travail/Fretlink/S3) get '
39 TMPFILE=$(mktemp /tmp/openvpn.XXXXXX)
40 pass show Travail/Fretlink/OpenVPN >> $TMPFILE
45 function dev_prompt() {
46 if [ -n "$FRETLINK_ENV" ]; then
47 echo "{$FRETLINK_ENV} "
53 if [ -n "$TMUX" ]; then
60 "bash") start_dir="$HOME";;
61 "puppet") start_dir="/etc/puppetlabs/code"
64 if tmux has-session -t "$type" 2>/dev/null; then
67 if [ -n "$start_dir" ]; then
68 tmux new-session -d -c $start_dir -s "$type" \; \
70 new-window -c $start_dir
72 tmux new-session -d -c "$HOME/workdir/$type" -s "$type" \; \
74 send-keys "../start" C-m \; \
75 rename-window "running" \; \
76 new-window -c "$HOME/workdir/$type"
83 local cur="${COMP_WORDS[COMP_CWORD]}"
84 prefix="$HOME/workdir/"
86 local items=($(IFS=' ' compgen -W "bash puppet" -- $cur) $(compgen -d $prefix$cur))
87 for item in ${items[@]}; do
88 [[ $item == $prefix.* ]] && continue
89 COMPREPLY+=("${item#$prefix}")
92 complete -o filenames -F _tmux_dev tmux_dev
96 # Non-printable chars need to be wrapped by \[ ... \] otherwise bash
97 # will wrongly count the size of the prompt and glitch when going
99 function git_prompt_color() {
100 git diff --quiet 2>/dev/null && git diff --cached --quiet 2>/dev/null
102 if [ "$gitstatus" -gt 0 ]; then
110 function git_prompt() {
111 gitinfo=$(git branch 2>/dev/null | grep "^*" | cut -c3-);
112 git diff --quiet 2>/dev/null && git diff --cached --quiet 2>/dev/null
114 gitlsfiles=$(git ls-files . 2>/dev/null | wc -l);
115 if [ "$gitinfo" -a "$gitlsfiles" -gt 0 ]; then
116 echo -e "($gitinfo) "
120 function error_code() {
122 if [[ $ret != 0 ]]; then
127 function running_jobs() {
129 if [[ $ret != 0 ]]; then
134 {% if role.get(profile) == "fretlink" %}
135 PS1='\[\033[01;31m\]$(error_code)\[\033[00;00m\]$(running_jobs)\[\033[01;32m\]$(dev_prompt)\[$(git_prompt_color)\]$(git_prompt)\[\033[00;32m\]\u@\h\[\033[94m\] \w \$\[\033[00m\] '
137 PS1='\[\033[01;31m\]$(error_code)\[\033[00;00m\]$(running_jobs)\[$(git_prompt_color)\]$(git_prompt)\[\033[00;32m\]\u@\h\[\033[94m\] \w \$\[\033[00m\] '
140 PROMPT_COMMAND="[[ -f "$XDG_STATE_HOME/bash/bashrc_temp" ]] && . $XDG_STATE_HOME/bash/bashrc_temp"
142 {% if "nodejs" in features.get(profile, []) %}
143 source /usr/share/nvm/init-nvm.sh