summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--roles/shell/bash/templates/bashrc.j237
-rw-r--r--roles/tools/templates/tmux.conf.j221
2 files changed, 37 insertions, 21 deletions
diff --git a/roles/shell/bash/templates/bashrc.j2 b/roles/shell/bash/templates/bashrc.j2
index 99ed55f..742e1e0 100644
--- a/roles/shell/bash/templates/bashrc.j2
+++ b/roles/shell/bash/templates/bashrc.j2
@@ -45,6 +45,43 @@ function dev_prompt() {
45 echo "{$FRETLINK_ENV} " 45 echo "{$FRETLINK_ENV} "
46 fi 46 fi
47} 47}
48
49function tmux_dev() {
50 type="${1:-bash}"
51 if [ -n "$TMUX" ]; then
52 m=switch-client
53 else
54 m=attach-session
55 fi
56
57 if tmux has-session -t "$type" 2>/dev/null; then
58 tmux $m -t "$type"
59 else
60 if [ "$type" = "bash" ]; then
61 tmux new-session -d -s "$type"
62 tmux $m -t "$type"
63 else
64 tmux new-session -d -c "$HOME/workdir/$type" -s "$type" \; \
65 $m -t "$type" \; \
66 send-keys "../start" C-m \; \
67 rename-window "running" \; \
68 new-window -c "$HOME/workdir/$type"
69 fi
70 fi
71}
72
73_tmux_dev() {
74 COMPREPLY=()
75 local cur="${COMP_WORDS[COMP_CWORD]}"
76 prefix="$HOME/workdir/"
77 local IFS=$'\n'
78 local items=($(compgen -W "bash" -- $cur) $(compgen -d $prefix$cur))
79 for item in ${items[@]}; do
80 [[ $item == $prefix.* ]] && continue
81 COMPREPLY+=("${item#$prefix}")
82 done
83}
84complete -o filenames -F _tmux_dev tmux_dev
48##### /Fretlink 85##### /Fretlink
49{% endif %} 86{% endif %}
50 87
diff --git a/roles/tools/templates/tmux.conf.j2 b/roles/tools/templates/tmux.conf.j2
index 8aad615..a7ac4ce 100644
--- a/roles/tools/templates/tmux.conf.j2
+++ b/roles/tools/templates/tmux.conf.j2
@@ -65,24 +65,3 @@ set-window-option -g window-status-bell-style fg=yellow,bold,underscore
65set -g default-terminal screen-256color 65set -g default-terminal screen-256color
66 66
67set -g mouse on 67set -g mouse on
68
69{% if role.get(profile) == "fretlink" %}
70new-session -A -c "$HOME/workdir/admin-root" -s admin-root
71send-keys "../start" C-m
72rename-window "running"
73new-window
74new-session -A -c "$HOME/workdir/carrier-directory" -s carrier-directory
75send-keys "../start" C-m
76rename-window "running"
77new-window
78new-session -A -c "$HOME/workdir/notifier" -s notifier
79send-keys "../start" C-m
80rename-window "running"
81new-window
82new-session -A -c "$HOME/workdir/geodata" -s geodata
83new-session -A -c "$HOME/workdir/app" -s app
84send-keys "../start" C-m
85rename-window "running"
86new-window
87select-window -t 1
88{% endif %}