zenu

Des menus dans votre terminal - retour accueil

git clone git://bebou.netlib.re/zenu
Log | Files | Refs |

commit a69009e004a5b7a4ae926b92c1aceb215ffa5ed6
parent fb3c849fc5468e838ccdd42e5898dd8aa7db21b5
Auterice: Marc Chantreux <mc@unistra.fr>
Date:   Tue, 25 Apr 2023 14:37:39 +0200

attempt to use zsh aliases

so templates could be closer than expected output.
didn't work immediately so it's commented for futher
experimentations.

Diffstat:
Mbin/build | 21++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/bin/build b/bin/build @@ -1,3 +1,4 @@ +#!/bin/zsh -ue #!/bin/sh -ue usage() <<-% cat @@ -17,17 +18,31 @@ shift case "$cmd" in (-h|help|--help) usage ;; (face | -f) sed -rn '/^##/q;s/_(.)/\x1b[7m\1\x1b[m/;s/^/ /p' "$@" +# Avoid Quoting hell (QH) with aliases: +# with QH ;; (script | -s) <<-% cat $( sed -rn '/^## *pre */,/^##/p' "$@" ) - # zenu.show read -sk1 zenu_key case "\$zenu_key" in (\$'\n') zenu-- $( sed -rn '/^## *react */,/^##/p' "$@" ) - esac + esac 2> \$zenu_store/err % +# wo QH (require zsh) +# ;; (script | -s) +# alias _zenu_hook_preprocess=$( sed -rn '/^## *pre */,/^##/p' "$@" ) +# alias _zenu_hook_react=$( sed -rn '/^## *react */,/^##/p' "$@" ) +# _zenu_action_builder() { +# _zenu_hook_preprocess +# read -sk1 zenu_key +# case "$zenu_key" +# in ($'\n') zenu-- +# _zenu_hook_react +# esac 2> $zenu_store/err +# } +# echo $functions[_zenu_action_builder] ;; (emph| -e) - sed -rn '/^##/q;s/(.*)_((.).*)/\3 \1\2 /;p' "$@" | tee -a LOG | awk ' + sed -rn '/^##/q;s/(.*)_((.).*)/\3 \1\2 /;p' "$@" | awk ' {line[i++]=$0} (l=length)>m {m=l} END { for (i=0; i<until ; ++i) printf "%-*s\n", m, line[i] }