add tmux-printer as submodule

This commit is contained in:
Jorge Morante 2017-04-23 18:50:13 +02:00
parent 42b4943eca
commit ec2d573757
4 changed files with 7 additions and 31 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "vendor/tmux-printer"]
path = vendor/tmux-printer
url = https://github.com/morantron/tmux-printer

View File

@ -3,6 +3,8 @@
CONF_CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $CONF_CURRENT_DIR/utils.sh
TMUX_PRINTER="$CONF_CURRENT_DIR/../vendor/tmux-printer/tmux-printer"
# TODO empty patterns are invalid
function check_pattern() {
echo "beep beep" | grep -e "$1" 2> /dev/null
@ -30,7 +32,7 @@ function set_option() {
}
function process_format () {
echo -e "$($CONF_CURRENT_DIR/print.sh "$1")\e[0m"
echo -e "$($TMUX_PRINTER "$1")\e[0m"
}
PATTERNS_LIST=(

View File

@ -1,30 +0,0 @@
#!/usr/bin/env bash
tmux_format="TMUX_PRINTER_FORMAT${1}TMUX_PRINTER_FORMAT_END"
style_conf=$(mktemp "/tmp/tmux-printer.XXXXXX")
empty_conf=$(mktemp "/tmp/tmux-printer.XXXXXX")
touch "$empty_conf"
echo "set -g status-left '$tmux_format'" >> "$style_conf"
echo "set -g status-left-length 255" >> "$style_conf"
echo "set -g status-right ''" >> "$style_conf"
PREV_TMUX=$TMUX
TMUX=''
tmux -L tmux-printer-outer -f "$empty_conf" new -s tmux-printer-outer -d
tmux -L tmux-printer-outer send-keys "TMUX='' tmux -L tmux-printer-inner -f \"$style_conf\""
tmux -L tmux-printer-outer send-keys Enter
sleep 0.1 # tmux wait?
output=$( \
tmux -L tmux-printer-outer capture-pane -p -e | \
grep --color=never -Eo "TMUX_PRINTER_FORMAT.*TMUX_PRINTER_FORMAT_END" | \
sed "s/TMUX_PRINTER_FORMAT\(_END\)\?//g" \
)
tmux -L tmux-printer-outer kill-server
tmux -L tmux-printer-inner kill-server
TMUX=$PREV_TMUX
echo -ne "$output$(tput sgr0)"

1
vendor/tmux-printer vendored Submodule

@ -0,0 +1 @@
Subproject commit 6574fdea20746706992b0eb84e2c4e6f5991b14a