diff options
author | makefu <github@syntax-fehler.de> | 2018-11-30 23:19:32 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2018-11-30 23:19:32 +0100 |
commit | b8db7293383772b936b6937cc05b5588021ca693 (patch) | |
tree | 74cd0a8da1fd703080697bed04ffc1a8279a60ae /lass/5pkgs/fzfmenu/default.nix | |
parent | 861d4481f710d60d0d84aa8b1f8997f7fc18890d (diff) | |
parent | 7f5431a4999fea9626df300f707aa8c62de894e3 (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'lass/5pkgs/fzfmenu/default.nix')
-rw-r--r-- | lass/5pkgs/fzfmenu/default.nix | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lass/5pkgs/fzfmenu/default.nix b/lass/5pkgs/fzfmenu/default.nix new file mode 100644 index 00000000..6b589935 --- /dev/null +++ b/lass/5pkgs/fzfmenu/default.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: + +pkgs.writeDashBin "fzfmenu" '' + set -efu + PROMPT=">" + for i in "$@" + do + case $i in + -p) + PROMPT="$2" + shift + shift + break + ;; + *) + echo "Unknown option $1" + shift + ;; + esac + done + INPUT=$(${pkgs.coreutils}/bin/cat) + OUTPUT="$(${pkgs.coreutils}/bin/mktemp)" + ${pkgs.rxvt_unicode}/bin/urxvt \ + -name fzfmenu -title fzfmenu \ + -e ${pkgs.dash}/bin/dash -c \ + "echo \"$INPUT\" | ${pkgs.fzf}/bin/fzf \ + --history=/dev/null \ + --no-sort \ + --prompt=\"$PROMPT\" \ + > \"$OUTPUT\"" 2>/dev/null + ${pkgs.coreutils}/bin/cat "$OUTPUT" + ${pkgs.coreutils}/bin/rm "$OUTPUT" +'' |