summaryrefslogtreecommitdiffstats
path: root/lass/5pkgs/fzfmenu
diff options
context:
space:
mode:
authorjeschli <jeschli@gmail.com>2018-12-04 19:27:27 +0100
committerjeschli <jeschli@gmail.com>2018-12-04 19:27:27 +0100
commit5030b74cc5c578bb82619a24592504a6008f1a10 (patch)
tree0551e3ddb94353b7438bec02174bf3379bc89b87 /lass/5pkgs/fzfmenu
parent78b289201987675844aa37abeb4279eb4051ebe0 (diff)
parent82988de84c177c247ebbe80940c4d50b9f073b4e (diff)
Merge branch 'master' of prism.r:stockholm
Diffstat (limited to 'lass/5pkgs/fzfmenu')
-rw-r--r--lass/5pkgs/fzfmenu/default.nix45
1 files changed, 45 insertions, 0 deletions
diff --git a/lass/5pkgs/fzfmenu/default.nix b/lass/5pkgs/fzfmenu/default.nix
new file mode 100644
index 000000000..905a5ce6b
--- /dev/null
+++ b/lass/5pkgs/fzfmenu/default.nix
@@ -0,0 +1,45 @@
+{ pkgs, ... }:
+
+pkgs.writeDashBin "fzfmenu" ''
+ set -efu
+ PROMPT=">"
+ for i in "$@"
+ do
+ case $i in
+ -p)
+ PROMPT="$2"
+ shift
+ shift
+ break
+ ;;
+ -l)
+ # no reason to filter number of lines
+ LINES="$2"
+ shift
+ shift
+ break
+ ;;
+ -i)
+ # we do this anyway
+ shift
+ break
+ ;;
+ *)
+ echo "Unknown option $1" >&2
+ 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"
+''