Already included in FreeBSD 14.0, bsddialog will replace dialog. I was looking at the 15.0 release notes and UPDATING files to see what new thing I could switch to using early as I did with portdialog. This one appears to be a much more developer-oriented item, so I will have to create some examples as I go, on the commmandline to give you something to see here.
% bsddialog Error: expected a --<dialog>. See 'bsddialog --help' or 'man 1 bsddialog' for more information. %
I really like this as feedback from attempting to use it without knowing how or what to do, it gives both the built-in help as below, plus informs about the much more verbose manpage option.
% bsddialog --help usage: bsddialog --help bsddialog --version bsddialog [--<opt>] --<dialog> <text> <rows> <cols> [<arg>] bsddialog --<dialog1> ... [--and-dialog --<dialog2> ...] ... Options: --alternate-screen, --ascii-lines, --backtitle <backtitle>, --begin-x <x>, --begin-y <y>, --bikeshed, --calendar, --cancel-label <label>, --clear-dialog, --clear-screen, --colors, --columns-per-row <columns>, --cr-wrap, --date-format <format>, --default-button <label>, --default-item <name>, --default-no, --disable-esc, --esc-return-cancel, --exit-label <label>, --extra-button, --extra-label <label>, --generic-button1 <label>, --generic-button2 <label>, --help-button, --help-label <label>, --help-print-name, --help-status, --hfile <file>, --hline <string>, --hmsg <string>, --ignore, --insecure, --item-bottom-desc, --item-depth, --item-prefix, --load-theme <file>, --max-input <size>, --no-cancel, --no-descriptions, --no-label <label>, --no-lines, --no-names, --no-ok, --no-shadow, --normal-screen, --ok-label <label>, --output-fd <fd>, --output-separator <sep>, --print-maxsize, --print-size, --print-version, --quoted, --save-theme <file>, --separate-output, --separator <sep>, --shadow, --single-quoted, --sleep <secs>, --stderr, --stdout, --tab-escape, --tab-len <spaces>, --text-unchanged, --switch-buttons, --theme <blackwhite|bsddialog|flat|dialog>, --time-format <format>, --title <title>, --yes-label <label>. Dialogs: --calendar <text> <rows> <cols> [<dd> <mm> <yy>] --checklist <text> <rows> <cols> <menurows> [<name> <desc> <on|off>] ... --datebox <text> <rows> <cols> [<dd> <mm> <yy>] --form <text> <rows> <cols> <formrows> [<label> <ylabel> <xlabel> <init> <yfield> <xfield> <fieldlen> <maxletters>] ... --gauge <text> <rows> <cols> [<perc>] --infobox <text> <rows> <cols> --inputbox <text> <rows> <cols> [init] --menu <text> <rows> <cols> <menurows> [<name> <desc>] ... --mixedform <text> <rows> <cols> <formrows> [<label> <ylabel> <xlabel> <init> <yfield> <xfield> <fieldlen> <maxletters> <0|1|2>] ... --mixedgauge <text> <rows> <cols> <mainperc> [<minilabel> <miniperc>] ... --msgbox <text> <rows> <cols> --passwordbox <text> <rows> <cols> [init] --passwordform <text> <rows> <cols> <formrows> [<label> <ylabel> <xlabel> <init> <yfield> <xfield> <fieldlen> <maxletters>] ... --pause <text> <rows> <cols> <secs> --radiolist <text> <rows> <cols> <menurows> [<name> <desc> <on|off>] ... --rangebox <text> <rows> <cols> <min> <max> [<init>] --textbox <file> <rows> <cols> --timebox <text> <rows> <cols> [<hh> <mm> <ss>] --treeview <text> <rows> <cols> <menurows> [<depth> <name> <desc> <on|off>] ... --yesno <text> <rows> <cols> See 'man 1 bsddialog' for more information. %
Here are some examples of what this tool can provide:
% bsddialog --calendar "Example calendar" 20 38 14 03
┌────────────────────────────────────┐ │ Example calendar │ │ │ │ │ │ Month Year │ │ ┌───────────────┐┌───────────────┐ │ │ │ March││ 2024│ │ │ └───────────────┘└───────────────┘ │ │ ┌────────────────────────────────┐ │ │ │ Sun Mon Tue Wed Thu Fri Sat │ │ │ │ 1 2 │ │ │ │ 3 4 5 6 7 8 9 │ │ │ │ 10 11 12 13 14 15 16 │ │ │ │ 17 18 19 20 21 22 23 │ │ │ │ 24 25 26 27 28 29 30 │ │ │ │ 31 │ │ │ └────────────────────────────────┘ │ ├────────────────────────────────────┤ │ [ OK ] [Cancel] │ └────────────────────────────────────┘
% bsddialog --inputbox "an inputbox" 8 20
┌──────────────────┐ │ an inputbox │ │ ┌──────────────┐ │ │ │ │ │ │ └──────────────┘ │ ├──────────────────┤ │ [ OK ] [Cancel]│ └──────────────────┘
% bsddialog --timebox "timebox" 8 20 10 27 05
┌──────────────────┐ │ timebox │ │ ┌──┐ ┌──┐ ┌──┐ │ │ │10│:│27│:│05│ │ │ └──┘ └──┘ └──┘ │ ├──────────────────┤ │ [ OK ] [Cancel]│ └──────────────────┘
% bsddialog --infobox "This is an infobox for giving info to the reader" 5 24
┌──────────────────────┐ │ This is an infobox │ │ for giving info to │ │ the reader │ └──────────────────────┘
bsddialog --menu "Choose what to do:" 12 40 3 "Leave" "Hit the road" "Stay" "Take a load off" "Think" "Ponder other options"
┌──────────────────────────────────────┐ │ Choose what to do: │ │ │ │ │ │ ┌──────────────────────────────────┐ │ │ │ Leave Hit the road │ │ │ │ Stay Take a load off │ │ │ │ Think Ponder other options │ │ │ └──────────────────────────────────┘ │ ├──────────────────────────────────────┤ │ [ OK ] [Cancel] │ └──────────────────────────────────────┘
These examples do not touch the large number of possible customizations. I used a few of the pre-designed options which you may notice has any text within quotes. When I tested the calendar it seems like the expected input might actually be a 4-digit year. You will get feedback if the content would not fit within the rows and columns defined, some of the needed space is for the default output which might not be known before you test with an extra large row/column value. Since this works within an xterm, I expect that the NO_COLOR environment variable would affect it as well, I am not sure that this has the other display options which portdialog has, possibly those would be good additions to it.
Since the dialog manpage is quite extensive I will provide the information about compatibility to the end of the manpage for both. One thing to note about dialog is that it is actually an X application, rather than a terminal program, and bsddialog is a TUI. The manpage excerpts are below.
DIALOG(1) General Commands Manual DIALOG(1) COMPATIBILITY You may want to write scripts which run with other dialog "clones". Original Dialog First, there is the "original" dialog program to consider (versions 0.3 to 0.9). It had some misspelled (or inconsistent) options. The dialog program maps those deprecated options to the preferred ones. They include: Option Treatment --------------------------------- --beep-after ignored --guage mapped to --gauge --------------------------------- Xdialog This is an X application, rather than a terminal program. With some care, it is possible to write useful scripts that work with both Xdialog and dialog. The dialog program ignores these options which are recognized by Xdialog: Option Treatment ----------------------------------------------- --allow-close ignored --auto-placement ignored --fixed-font ignored --icon ignored --keep-colors ignored --no-close ignored --no-cr-wrap ignored --screen-center ignored --separator mapped to --separate-output --smooth ignored --under-mouse ignored --wmclass ignored ----------------------------------------------- Xdialog's manpage has a section discussing its compatibility with dialog. There are some differences not shown in the manpage. For example, the html documentation states Note: former Xdialog releases used the "\n" (line feed) as a results separator for the checklist widget; this has been changed to "/" in Xdialog v1.5.0 to make it compatible with (c)dialog. In your old scripts using the Xdialog checklist, you will then have to add the --separate-output option before the --checklist one. Dialog has not used a different separator; the difference was likely due to confusion regarding some script. Whiptail Then there is whiptail. For practical purposes, it is maintained by Debian (very little work is done by its upstream developers). Its documentation (README.whiptail) claims whiptail(1) is a lightweight replacement for dialog(1), to provide dialog boxes for shell scripts. It is built on the newt windowing library rather than the ncurses library, allowing it to be smaller in embedded environments such as installers, rescue disks, etc. whiptail is designed to be drop-in compatible with dialog, but has less features: some dialog boxes are not implemented, such as tailbox, timebox, calendarbox, etc. Comparing actual sizes (Debian testing, 2007/1/10): The total of sizes for whiptail, the newt, popt and slang libraries is 757 KB. The comparable number for dialog (counting ncurses) is 520 KB. Disregard the first paragraph. The second paragraph is misleading, since whiptail also does not work for common options of dialog, such as the gauge box. whiptail is less compatible with dialog than the original mid-1990s dialog 0.4 program. whiptail's manpage borrows features from dialog, e.g., but oddly cites only dialog versions up to 0.4 (1994) as a source. That is, its manpage refers to features which were borrowed from more recent versions of dialog, e.g., o --gauge (from 0.5) o --passwordbox (from Debian changes in 1999), o --default-item (from dialog 2000/02/22), o --output-fd (from dialog 2002/08/14). Somewhat humorously, one may note that the popt feature (undocumented in its manpage) of using a "--" as an escape was documented in dialog's manpage about a year before it was mentioned in whiptail's manpage. whiptail's manpage incorrectly attributes that to getopt (and is inaccurate anyway). Debian uses whiptail for the official dialog variation. The dialog program ignores or maps these options which are recognized by whiptail: Option Treatment ------------------------------------------- --cancel-button mapped to --cancel-label --fb ignored --fullbutton ignored --no-button mapped to --no-label --nocancel mapped to --no-cancel --noitem mapped to --no-items --notags mapped to --no-tags --ok-button mapped to --ok-label --scrolltext mapped to --scrollbar --topleft mapped to --begin 0 0 --yes-button mapped to --yes-label ------------------------------------------- There are visual differences which are not addressed by command-line options: o dialog centers lists within the window. whiptail typically puts lists against the left margin. o whiptail uses angle brackets ("<" and ">") for marking buttons. dialog uses square brackets. o whiptail marks the limits of subtitles with vertical bars. dialog does not mark the limits. o whiptail attempts to mark the top/bottom cells of a scrollbar with up/down arrows. When it cannot do this, it fills those cells with the background color of the scrollbar and confusing the user. dialog uses the entire scrollbar space, thereby getting better resolution. BUGS Perhaps. AUTHOR Thomas E. Dickey (updates for 0.9b and beyond) CONTRIBUTORS Kiran Cherupally - the mixed form and mixed gauge widgets. Tobias C. Rittweiler Valery Reznic - the form and progressbox widgets. Yura Kalinichenko adapted the gauge widget as "pause". This is a rewrite (except as needed to provide compatibility) of the earlier version of dialog 0.9a, which lists as authors: o Savio Lam - version 0.3, "dialog" o Stuart Herbert - patch for version 0.4 o Marc Ewing - the gauge widget. o Pasquale De Marco "Pako" - version 0.9a, "cdialog" $Date: 2021/01/17 17:25:01 $ DIALOG(1)
And in comparison, bsddialog which being less extensive and purely a TUI. It can still be contained by an Xterm without need of direct interaction with X itself, and so very likely is a bit less hefty, could be speedier, or take up less space installed.
BSDDIALOG(1) General Commands Manual BSDDIALOG(1) COMPATIBILITY Outdated options are retained for compatibility, properly equivalent options are used: Obsolete Equivalent --and-widget --and-dialog --calendar <text> 2 <cols> --calendar <text> 0 <cols> --clear --clear-screen --defaultno --default-no --exit-label --ok-label --help-tags --help-print-name --item-help --item-bottom-desc --keep-tite --alternate-screen --no-items --no-descriptions --no-label --cancel-label --no-tags --no-names --nocancel --no-cancel --nook --no-ok --separator --output-separator --yes-label --ok-label SEE ALSO bsddialog(3) HISTORY The bsddialog utility first appeared in FreeBSD 14.0. AUTHORS bsddialog was written by Alfonso Sabato Siciliano <asiciliano@FreeBSD.org>. bsddialog provides a subset of the functionality described in the dialog manual. The following features were reimplemented: Options: --and-widget, --ascii-lines, --backtitle, --cancel-label, --clear, --colors, --cr-wrap, --date-format, --defaultno, --default-button, --default-no, --default-item, --exit-label, --extra-button, --extra-label, --help, --help-button, --help-label, --help-status, --help-tags, --hfile, --hline, --ignore, --insecure, --item-help, --keep-tite, --max-input, --no-cancel, --nocancel, --no-items, --no-label, --no-lines, --no-ok, --nook, --no-shadow, --no-tags, --ok-label, --output-fd, --output-separator, --print-maxsize, --print-size, --print-version, --quoted, --separate-output, --separator, --shadow, --single-quoted, --sleep, --stderr, --stdout, --tab-len, --time-format, --title, --version, --yes-label. Dialogs: --calendar, --checklist, --form, --gauge, --infobox, --inputbox, --menu, --mixedform, --mixedgauge, --msgbox, --passwordbox, --passwordform, --pause, --radiolist, --rangebox, --textbox, --timebox, --treeview, --yesno. Some feature differs in input, output, or behavior. Compatibility is not a priority for future development. THANKS TO Baptiste Daroussin <bapt@FreeBSD.org>, Ed Maste <emaste@FreeBSD.org> and Juraj Lutter <otis@FreeBSD.org> for suggestions, help, and testing. FreeBSD 13.2 September 23, 2022 BSDDIALOG(1)
Aside from a functionally similar tool and some things partly compatible, it is not truly a drop-in replacement as switching to portdialog from dialiog4 ports. There are some notable mentions in UPDATING which should be considered.
From UPDATING:
20231010: dialog(1) has been replaced in base by bsddialog(1), while most of the time replacing a dialog(1) call by a bsddialog(1) call works out of the box, bsddialog(1) is not considered as a drop-in replacement for dialog(1). If you do depend on dialog(1) functionality, please install cdialog from ports: pkg install cdialog
From RELNOTES: (for FreeBSD 15.0.)
ff01d71e48d4: dialog(1) has been replaced by bsddialog(1)
This looks like a cool new thing for us to have available, bsddialog offers more flexibility to ease a greater variety of dialog types. I might consider some rewrites to some of my scripts to include bsddialog if it is possible (I suspect so) which would make them even more friendly and easy to use I believe. Look into what bsddialog is on your FreeBSD 14.0 system or CURRENT (aka 15.0) to see how you might take advantage of this interesting flexible dialog creation tool.
PS. This has been an effort for GPLinBase for removal of those items so licensed (few remain), bsddialog is one completed for that project.
No comments:
Post a Comment
Thank you for your interest!