diff options
Diffstat (limited to 'roles/shell')
-rw-r--r-- | roles/shell/bash/templates/bashrc.j2 | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/roles/shell/bash/templates/bashrc.j2 b/roles/shell/bash/templates/bashrc.j2 index 742e1e0..2018f55 100644 --- a/roles/shell/bash/templates/bashrc.j2 +++ b/roles/shell/bash/templates/bashrc.j2 | |||
@@ -54,12 +54,18 @@ function tmux_dev() { | |||
54 | m=attach-session | 54 | m=attach-session |
55 | fi | 55 | fi |
56 | 56 | ||
57 | case "$type" in | ||
58 | "bash") start_dir="$HOME";; | ||
59 | "puppet") start_dir="/etc/puppetlabs/code" | ||
60 | esac | ||
61 | |||
57 | if tmux has-session -t "$type" 2>/dev/null; then | 62 | if tmux has-session -t "$type" 2>/dev/null; then |
58 | tmux $m -t "$type" | 63 | tmux $m -t "$type" |
59 | else | 64 | else |
60 | if [ "$type" = "bash" ]; then | 65 | if [ -n "$start_dir" ]; then |
61 | tmux new-session -d -s "$type" | 66 | tmux new-session -d -c $start_dir -s "$type" \; \ |
62 | tmux $m -t "$type" | 67 | $m -t "$type" \; \ |
68 | new-window -c $start_dir | ||
63 | else | 69 | else |
64 | tmux new-session -d -c "$HOME/workdir/$type" -s "$type" \; \ | 70 | tmux new-session -d -c "$HOME/workdir/$type" -s "$type" \; \ |
65 | $m -t "$type" \; \ | 71 | $m -t "$type" \; \ |
@@ -75,7 +81,7 @@ _tmux_dev() { | |||
75 | local cur="${COMP_WORDS[COMP_CWORD]}" | 81 | local cur="${COMP_WORDS[COMP_CWORD]}" |
76 | prefix="$HOME/workdir/" | 82 | prefix="$HOME/workdir/" |
77 | local IFS=$'\n' | 83 | local IFS=$'\n' |
78 | local items=($(compgen -W "bash" -- $cur) $(compgen -d $prefix$cur)) | 84 | local items=($(IFS=' ' compgen -W "bash puppet" -- $cur) $(compgen -d $prefix$cur)) |
79 | for item in ${items[@]}; do | 85 | for item in ${items[@]}; do |
80 | [[ $item == $prefix.* ]] && continue | 86 | [[ $item == $prefix.* ]] && continue |
81 | COMPREPLY+=("${item#$prefix}") | 87 | COMPREPLY+=("${item#$prefix}") |