dotfiles

configuration files for shell, text editor, graphical environment, etc.
git clone git://src.adamsgaard.dk/dotfiles # fast
git clone https://src.adamsgaard.dk/dotfiles.git # slow
Log | Files | Refs | README | LICENSE Back to index

tsvplumb (398B)


      1 #!/bin/sh
      2 # requirements: dmenu, fzy
      3 # Sends the string in the second column of a tab-separated file to
      4 # the plumb command.
      5 
      6 if [ "$#" -lt 1 ]; then
      7 	tsv="$(cat)"
      8 else
      9 	tsv="$(cat "$1")"
     10 fi
     11 
     12 lines=8
     13 if [ -z "$TERM" ]; then
     14 	t="$(printf '%s' "$tsv" | dmenu -i -l "$lines")"
     15 else
     16 	t="$(printf '%s' "$tsv" | fzy -l "$lines")"
     17 fi
     18 if [ -z "$t" ]; then
     19 	exit 1
     20 fi
     21 
     22 plumb "$(printf '%s' "$t" | cut -f2)"