BSDDialog

Posted on December 7, 2021

BSDDialog is an utility to write a script with a Text User Interface. It can build widgets/dialogs: to show messages, to get input and to inform about a computation status.

Example to build a msgbox with Hello World!:

% bsddialog --msgbox "Hello World!" 8 20

Of course, it is possible to use bsddialog in a shell script, “Yes-No Question” example:

#!/bin/sh

${BSDDIALOG_YES=0}
${BSDDIALOG_NO=1}

bsddialog --theme bsddialog --color --title " yesno " \
	--yesno "\nHello \Z3World\Zn!" 10 30

case $? in
	$BSDDIALOG_YES )
		echo "YES!"
		;;
	$BSDDIALOG_NO )
		echo "NO!"
		;;
esac


The utility is designed and developed mainly for FreeBSD, the first version 0.0.1 is out, please consider this a testing version, let me know any problem.

To install the port devel/bsddialog:

# cd /usr/ports/devel/bsddialog/ && make install clean

To add the package:

# pkg install bsddialog

To build from sources:

$ git clone https://gitlab.com/alfix/bsddialog.git
$ cd bsddialog
$ make

Features:

% bsddialog --version
bsddialog 0.0.1 (libbsddialog 0.1-devel).
% bsddialog --help

  • Messages: infobox, msgbox, yesno.
  • Menus: radiolist, checklist, menu, treeview, buildlist.
  • Forms: inputbox, form, mixedform, passwordbox, passwordform,
  • Bars: gauge, pause, mixedgauge, rangebox.
  • Date and time: datebox, timebox.
  • Text: textbox.

The project has a list of examples, some screenshot, preview:

BSDDialog

BSDDialog is an open source project released under the term of the BSD 2 Clause License, repository: https://gitlab.com/alfix/bsddialog.

Happy Hacking!