From 9fdc41e6ffec41926c1c4fcbd3d948e2708cb85e Mon Sep 17 00:00:00 2001 From: Marian Minar Date: Sat, 16 Oct 2021 15:26:36 -0700 Subject: [PATCH] simplify the suggested menu command --- README.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.txt b/README.txt index 7ccdde9..530ac69 100644 --- a/README.txt +++ b/README.txt @@ -15,8 +15,7 @@ TODO Bonus ----- -You can alias a simple command like this one in zsh: +You can alias a simple command like this one to get a nice menu that prints out the command: - alias oneliner='print -z $(grep "(\*)" -rw oneliners.txt | fzf -e | sed "s/: \{1,\}/\n/" | tail -1 | sed "s/^\`//;s/\`$//")' - -Which will give you a `fzf` menu and then print the command directly into the shell for editing or execution. + alias oneliner='print -z $(grep "^(\*)" oneliners.txt | fzf -e | grep -oP "(?<=: \`).*(?=\`$)")' + (requirements: zsh is your shell, GNU grep, fzf)