xref: /freebsd/contrib/dialog/samples/checklist12 (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1#! /bin/sh
2# $Id: checklist12,v 1.5 2020/11/26 00:03:58 tom Exp $
3
4. ./setup-vars
5
6. ./setup-edit
7
8case "x$DIALOGOPTS" in
9*--no-items*|*--noitem*)
10	CUT="cut -d: -f1,3"
11	;;
12*)
13	CUT="cat"
14	;;
15esac
16
17$CUT >$input <<-EOF
18	Apple:It's an apple.:off
19	Dog:No, that's not my dog.:ON
20	Orange:Yeah, that's juicy.:off
21	Chicken:Normally not a pet.:off
22	Cat:No, never put a dog and a cat together!:oN
23	Fish:Cats like fish.:On
24	Lemon:You know how it tastes.:on
25EOF
26sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' <$input >$output
27cat $output >$input
28
29$DIALOG --backtitle "No Such Organization" \
30	--title "CHECKLIST BOX" "$@" \
31        --checklist "Hi, this is a checklist box. You can use this to \n\
32present a list of choices which can be turned on or \n\
33off. If there are more items than can fit on the \n\
34screen, the list will be scrolled. You can use the \n\
35UP/DOWN arrow keys, the first letter of the choice as a \n\
36hot key, or the number keys 1-9 to choose an option. \n\
37Press SPACE to toggle an option on/off. \n\n\
38  Which of the following are fruits?" 20 61 5 \
39	--file $input 2> $output
40
41returncode=$?
42
43tempfile=$output
44. ./report-tempfile
45