]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/dialog/samples/checklist12
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / dialog / samples / checklist12
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
8 case "x$DIALOGOPTS" in
9 *--no-items*|*--noitem*)
10         CUT="cut -d: -f1,3"
11         ;;
12 *)
13         CUT="cat"
14         ;;
15 esac
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
25 EOF
26 cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output
27 cat $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\
32 present a list of choices which can be turned on or \n\
33 off. If there are more items than can fit on the \n\
34 screen, the list will be scrolled. You can use the \n\
35 UP/DOWN arrow keys, the first letter of the choice as a \n\
36 hot key, or the number keys 1-9 to choose an option. \n\
37 Press 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
41 retval=$?
42
43 tempfile=$output
44 . ./report-tempfile