mirror of
https://github.com/kmein/niveum
synced 2026-03-20 20:01:08 +01:00
fix(fzfmenu): include bash and handle options
This commit is contained in:
@@ -111,7 +111,7 @@ in
|
|||||||
fzfmenu = wrapScript {
|
fzfmenu = wrapScript {
|
||||||
script = ./fzfmenu.sh;
|
script = ./fzfmenu.sh;
|
||||||
name = "fzfmenu";
|
name = "fzfmenu";
|
||||||
packages = [ pkgs.st pkgs.fzf pkgs.dash ];
|
packages = [ pkgs.st pkgs.fzf pkgs.dash pkgs.bash ];
|
||||||
};
|
};
|
||||||
|
|
||||||
bvg = pkgs.callPackage ./bvg.nix {};
|
bvg = pkgs.callPackage ./bvg.nix {};
|
||||||
|
|||||||
@@ -9,10 +9,32 @@ mkfifo "$input"
|
|||||||
mkfifo "$output"
|
mkfifo "$output"
|
||||||
chmod 600 "$input" "$output"
|
chmod 600 "$input" "$output"
|
||||||
|
|
||||||
|
for i in "$@"; do
|
||||||
|
case $i in
|
||||||
|
-p)
|
||||||
|
PROMPT="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
break ;;
|
||||||
|
-l)
|
||||||
|
# no reason to filter number of lines
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
break ;;
|
||||||
|
-i)
|
||||||
|
# we do this anyway
|
||||||
|
shift
|
||||||
|
break ;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option $1" >&2
|
||||||
|
shift ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
# it's better to use st here (starts a lot faster than pretty much everything else)
|
# it's better to use st here (starts a lot faster than pretty much everything else)
|
||||||
st -c fzfmenu -n fzfmenu -g 85x10 \
|
st -c fzfmenu -n fzfmenu -g 85x10 \
|
||||||
-e dash \
|
-e dash \
|
||||||
-c "cat $input | fzf --print-query $* | tee $output" & disown
|
-c "cat $input | fzf --reverse --prompt='${PROMPT+> }' --print-query $* | tee $output" & disown
|
||||||
|
|
||||||
# handle ctrl+c outside child terminal window
|
# handle ctrl+c outside child terminal window
|
||||||
trap 'kill $! 2>/dev/null; rm -f $input $output' EXIT
|
trap 'kill $! 2>/dev/null; rm -f $input $output' EXIT
|
||||||
|
|||||||
Reference in New Issue
Block a user