From c464effa80ed83d4e146dabd6b8bd6bb9dacb3f9 Mon Sep 17 00:00:00 2001 From: pgen Date: Fri, 22 Mar 2019 23:46:45 +0100 Subject: Improve the simple_menu example --- examples/simple_menu/README | 2 +- examples/simple_menu/simple_menu.sh | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'examples') diff --git a/examples/simple_menu/README b/examples/simple_menu/README index 7ee280c..5061976 100644 --- a/examples/simple_menu/README +++ b/examples/simple_menu/README @@ -33,7 +33,7 @@ As usual, 'ENTER' triggers the selection and 'q' quits the menu without outputting anything. To launch the demo, first, make sure to make simple_menu.sh executable -(chmod +x simple_menu.sh) and enter: +(chmod +x simple_menu.sh actions.sh) and enter: ./simple_menu.sh main.mnu ./actions.sh diff --git a/examples/simple_menu/simple_menu.sh b/examples/simple_menu/simple_menu.sh index 827afc8..1d8dd7d 100644 --- a/examples/simple_menu/simple_menu.sh +++ b/examples/simple_menu/simple_menu.sh @@ -102,14 +102,15 @@ function process_menu ITEMS_TO_ADD=1 # By default, only one iteration of the tag is taken # into account - (( ${#TAG} > 10 )) && error "Menu tag too long (max 10 characters)." + (( ${#TAG} > 30 )) \ + && error "Menu tag \"${TAG}\" too long (max 30 characters)." [[ $TAG == --- ]] && VALUE=@@@ [[ $TAG == === ]] && VALUE=@@@ && ITEMS_TO_ADD=COL [[ -z $VALUE ]] && error "Empty menu entry for $TAG" - [[ $TAG == EXIT ]] && TAG="@EXIT@xxxx00" - [[ $TAG == "<"* ]] && TAG="