xref: /freebsd/contrib/dialog/samples/checklist12 (revision eda14cbc264d6969b02f2b1994cef11148e914f1)
1#! /bin/sh
2# $Id: checklist12,v 1.3 2012/12/23 22:27:51 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
26cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$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
41retval=$?
42
43tempfile=$output
44. ./report-tempfile
45