xref: /freebsd/contrib/bsddialog/examples_utility/radiolist.sh (revision 744bfb213144c63cbaf38d91a1c4f7aebb9b9fbc)
1#!/bin/sh
2#-
3# SPDX-License-Identifier: CC0-1.0
4#
5# Written in 2021 by Alfonso Sabato Siciliano.
6#
7# To the extent possible under law, the author has dedicated all copyright
8# and related and neighboring rights to this software to the public domain
9# worldwide. This software is distributed without any warranty, see:
10#	<http://creativecommons.org/publicdomain/zero/1.0/>.
11
12: ${BSDDIALOG_ERROR=255}
13: ${BSDDIALOG_OK=0}
14: ${BSDDIALOG_CANCEL=1}
15: ${BSDDIALOG_ESC=5}
16
17ITEM=$(./bsddialog --title " radiolist " --radiolist "Hello World!" 15 30 5 \
18	"Tag 1"  "DESC 1 xyz"  off \
19	"Tag 2"  "DESC 2 xyz"  off \
20	"Tag 3"  "DESC 3 xyz"  on  \
21	"Tag 4"  "DESC 4 xyz"  off \
22	"Tag 5"  "DESC 5 xyz"  off \
233>&1 1>&2 2>&3 3>&-)
24
25case $? in
26	$BSDDIALOG_ERROR )
27		exit 1
28	;;
29	$BSDDIALOG_ESC )
30		echo "[ESC] focus "
31	;;
32	$BSDDIALOG_CANCEL )
33		echo "[Cancel] focus "
34	;;
35	$BSDDIALOG_OK )
36		echo "[OK]"
37	;;
38esac
39
40echo "$ITEM"
41