はじめに

いつものように、formulaをみていたら、ダイアログを表示するコマンドがあるようなので試してみる。
https://formulae.brew.sh/formula/dialog

環境

1
2
MacOS Sonoma 14.4.1
Homebrew 4.2.17

dialogのインストール

1
brew install dialog
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
brew install dialog
==> Downloading https://ghcr.io/v2/homebrew/core/dialog/manifests/1.3-20240307
###################################################################################################################################################### 100.0%
==> Fetching dialog
==> Downloading https://ghcr.io/v2/homebrew/core/dialog/blobs/sha256:17a2372888ee3845cc799e55644848a3a8d913590349a3e0762b9f3dc393282c
###################################################################################################################################################### 100.0%
==> Pouring dialog--1.3-20240307.sonoma.bottle.tar.gz
🍺  /usr/local/Cellar/dialog/1.3-20240307: 14 files, 928.9KB
==> Running `brew cleanup dialog`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

使ってみる

 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
dialog --help
cdialog (ComeOn Dialog!) version 1.3-20240307
Copyright 2000-2023,2024 Thomas E. Dickey
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

* Display dialog boxes from shell scripts *

Usage: dialog <options> { --and-widget <options> }
where options are "common" options, followed by "box" options

Special options:
  [--create-rc "file"]
Common options:
  [--ascii-lines] [--aspect <ratio>] [--backtitle <backtitle>] [--beep]
  [--beep-after] [--begin <y> <x>] [--cancel-label <str>] [--clear]
  [--color-mode <mask>] [--colors] [--column-separator <str>] [--cr-wrap]
  [--cursor-off-label] [--date-format <str>] [--default-button <str>]
  [--default-item <str>] [--defaultno] [--erase-on-exit]
  [--exit-label <str>] [--extra-button] [--extra-label <str>]
  [--help-button] [--help-label <str>] [--help-status] [--help-tags]
  [--hfile <str>] [--hline <str>] [--ignore] [--input-fd <fd>]
  [--insecure] [--item-help] [--keep-tite] [--keep-window] [--last-key]
  [--max-input <n>] [--no-cancel] [--no-collapse] [--no-hot-list]
  [--no-items] [--no-kill] [--no-label <str>] [--no-lines] [--no-mouse]
  [--no-nl-expand] [--no-ok] [--no-shadow] [--no-tags]
  [--ok-label <str>] [--output-fd <fd>] [--output-separator <str>]
  [--print-maxsize] [--print-size]
  [--print-text-only <text> <height> <width>]
  [--print-text-size <text> <height> <width>] [--print-version] [--quoted]
  [--reorder] [--scrollbar] [--separate-output] [--separate-widget <str>]
  [--single-quoted] [--size-err] [--sleep <secs>] [--stderr] [--stdout]
  [--tab-correct] [--tab-len <n>] [--time-format <str>] [--timeout <secs>]
  [--title <title>] [--trace <file>] [--trim] [--version] [--visit-items]
  [--week-start <str>] [--yes-label <str>]
Box options:
  --buildlist    <text> <height> <width> <list-height> <tag1> <item1> <status1>...
  --calendar     <text> <height> <width> <day> <month> <year>
  --dselect      <directory> <height> <width>
  --editbox      <file> <height> <width>
  --form         <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
  --fselect      <filepath> <height> <width>
  --gauge        <text> <height> <width> [<percent>]
  --infobox      <text> <height> <width>
  --inputbox     <text> <height> <width> [<init>]
  --inputmenu    <text> <height> <width> <menu height> <tag1> <item1>...
  --menu         <text> <height> <width> <menu height> <tag1> <item1>...
  --mixedform    <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1> <itype>...
  --mixedgauge   <text> <height> <width> <percent> <tag1> <item1>...
  --msgbox       <text> <height> <width>
  --passwordbox  <text> <height> <width> [<init>]
  --passwordform <text> <height> <width> <form height> <label1> <l_y1> <l_x1> <item1> <i_y1> <i_x1> <flen1> <ilen1>...
  --pause        <text> <height> <width> <seconds>
  --prgbox       <text> <command> <height> <width>
  --programbox   <text> <height> <width>
  --progressbox  <text> <height> <width>
  --radiolist    <text> <height> <width> <list height> <tag1> <item1> <status1>...
  --rangebox     <text> <height> <width> <min-value> <max-value> <default-value>
  --tailbox      <file> <height> <width>
  --tailboxbg    <file> <height> <width>
  --textbox      <file> <height> <width>
  --timebox      <text> <height> <width> <hour> <minute> <second>
  --treeview     <text> <height> <width> <list-height> <tag1> <item1> <status1> <depth1>...
  --yesno        <text> <height> <width>

Auto-size with height and width = 0. Maximize with height and width = -1.
Global-auto-size if also menu_height/list_height = 0.

infoboxの表示

1
dialog --infobox test 50 50
infobox

yes/no表示

1
dialog --yesno まきますか? 50 50
yesno

チェックリスト表示

1
dialog --checklist チェックリスト 50 50 3 タグ1 アイテム1 1 タグ2 アイテム2 1 タグ3 アイテム3 1
checklist

おわりに

ダイアログを表示するコマンドを使ってみた。
最初見た時は、あれこれってaptitude とか BIOSの画面でよくみるアレ?ではないだろうかと思った。
詳しく調べていないけど、これで作られているのかな〜。
ターミナルでダイアログ表示させるときはこれを使おう・・・!