mrdialog 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ChangeLog.md +32 -1
- data/Gemfile +4 -4
- data/LICENSE.txt +1 -1
- data/Makefile +29 -0
- data/Notes.txt +24 -0
- data/README.md +169 -88
- data/VERSION +1 -1
- data/docs/ChangeLog.md +132 -0
- data/docs/README.md +294 -0
- data/lib/mrdialog/mrdialog.rb +120 -149
- data/samples/checklist.rb +17 -6
- data/samples/form3.rb +72 -23
- data/samples/textbox.rb +65 -0
- metadata +18 -16
- data/mrdialog.gemspec +0 -124
- data/pkg/md5.txt +0 -1
- data/pkg/mrdialog-1.0.5.gem +0 -0
data/docs/README.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
## Introduction
|
|
2
|
+
|
|
3
|
+
`mrdialog` is a pure
|
|
4
|
+
[ruby](https://www.ruby-lang.org/) library for the ncurses
|
|
5
|
+
[dialog](http://invisible-island.net/dialog/dialog.html) program.
|
|
6
|
+
[dialog](http://invisible-island.net/dialog/dialog.html) is
|
|
7
|
+
a command line tool that can present questions, messages, forms using
|
|
8
|
+
dialog boxes from a shell script on terminal. If you compiled linux kernel and typed
|
|
9
|
+
`make menuconfig`, configured Linux from command line with various
|
|
10
|
+
configuration managers, you have used 'dialog' like programs. Please
|
|
11
|
+
have a lookt at the [screenshots](screenshots/) on the dialogs look
|
|
12
|
+
like.
|
|
13
|
+
|
|
14
|
+
However, it is painful to program dialog from shell scripts due to lack of
|
|
15
|
+
data structure. You constantly have to watch if the correct number of
|
|
16
|
+
items are specified, if the arguments are in correct order for example. It is
|
|
17
|
+
a lot of fun to program dialog from an object oriented scripting language like
|
|
18
|
+
[ruby](https://www.ruby-lang.org/). Compare the sample shell scripts of dialog program with
|
|
19
|
+
the sample ruby scripts of mrdialog in the [samples](samples/) directory, I think you will agree. Look at [samples/extra_button/](samples/extra_button/) directory for samples on using an extra button on various input dialogs.
|
|
20
|
+
|
|
21
|
+
MRDialog is based on the rdialog ruby gem http://rdialog.rubyforge.org/ by
|
|
22
|
+
Aleks Clark (Does not seem to exist anymore).
|
|
23
|
+
|
|
24
|
+
I did the following:
|
|
25
|
+
|
|
26
|
+
- Added features and support for all of the missing widgets.
|
|
27
|
+
- Fixed the bugs I found.
|
|
28
|
+
- Implemented the examples for all the widgets.
|
|
29
|
+
|
|
30
|
+
If you have bug reports, questions, requests or suggestions, please enter it in the [Issues](https://github.com/muquit/mrdialog/issues) with an appropriate label.
|
|
31
|
+
|
|
32
|
+
## Latest Version (1.0.7 - Oct-19-2025)
|
|
33
|
+
|
|
34
|
+
The latest version is 1.0.7
|
|
35
|
+
|
|
36
|
+
**Important fix in 1.0.7**: Fixed a parsing bug where dialog commands
|
|
37
|
+
would fail if any text contained apostrophes (single quotes). All special
|
|
38
|
+
characters in user input are now properly handled.
|
|
39
|
+
|
|
40
|
+
Please look at the [ChangeLog.md](ChangeLog.md) file for details. Please look at the [screenshots](screenshots/) to see how the widgets look like.
|
|
41
|
+
|
|
42
|
+
## To install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
gem install mrdialog
|
|
46
|
+
or
|
|
47
|
+
sudo gem install mrdialog
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## To uninstall
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
gem uninstall mrdialog
|
|
54
|
+
or
|
|
55
|
+
sudo gem uninstall mrdialog
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
## Screenshots
|
|
60
|
+
|
|
61
|
+
Please look at the [screenshots](screenshots/) directory. There are individual screenshots for each of the widgets. Also the animated GIF file [all.gif](screenshots/all.gif) contains screenshot of all the widgets.
|
|
62
|
+
|
|
63
|
+
## Requirements
|
|
64
|
+
|
|
65
|
+
The [dialog](http://invisible-island.net/dialog/dialog.html) program must be installed. Note: the dialog program that is available in ubuntu is little old. Check the dialog version by typing `dialog --version`
|
|
66
|
+
|
|
67
|
+
I tested with `Version: 1.3-20250116`
|
|
68
|
+
|
|
69
|
+
dialog HOME: http://invisible-island.net/dialog/dialog.html.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## Run the sample apps
|
|
73
|
+
|
|
74
|
+
Find out where the mrdialog gem is installed. Example:
|
|
75
|
+
```bash
|
|
76
|
+
gem which mrdialog
|
|
77
|
+
/Users/muquit/.rvm/gems/ruby-3.2.2/gems/mrdialog-1.0.7/lib/mrdialog.rb
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
`cd` to the `samples` directory and run the apps.
|
|
82
|
+
Example:
|
|
83
|
+
```bash
|
|
84
|
+
cd /Users/muquit/.rvm/gems/ruby-3.2.2/gems/mrdialog-1.0.7/samples
|
|
85
|
+
./msgbox.rb
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Look at samples/extra_button/ on how to use an extra button on various input
|
|
89
|
+
dialogs.
|
|
90
|
+
|
|
91
|
+
## How to use the API
|
|
92
|
+
|
|
93
|
+
For now, please look at the apps in [samples](samples/) directory to see how the API works.
|
|
94
|
+
|
|
95
|
+
require 'mrdialog'
|
|
96
|
+
dialog = MRDialog.new
|
|
97
|
+
|
|
98
|
+
## Properties
|
|
99
|
+
|
|
100
|
+
The various properties of the dialog (shadow, title etc.) can be set by calling the appropriate setters. The supported properties are shown below:
|
|
101
|
+
|
|
102
|
+
| Property | Example | Description | Default |
|
|
103
|
+
| -------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
|
104
|
+
| shadow | `dialog.shadow = false` | Draw a shadow to the right and bottom of each dialog box. | true |
|
|
105
|
+
| title | `dialog.title = 'foo'` | Specifies a title string to be displayed at the top of the dialog box | N/A |
|
|
106
|
+
| logger | `dialog.logger = Logger.new("dialog.log")` | Debug messages will be logged to the specified ruby Logger | N/A |
|
|
107
|
+
| clear | `dialog.clear = true` | Clears the widget screen, keeping only the screen_color background. | false |
|
|
108
|
+
| insecure | `dialog.insecure = true` | Makes the password widget friendlier but less secure, by echoing asterisks for each character. | false |
|
|
109
|
+
| ascii_lines | `dialog.ascii_lines = true` | Rather than draw graphics lines around boxes, draw ASCII "+" and "-" in the same place. See also "--no-lines". | false |
|
|
110
|
+
| rc_file | `dialog.rc_file = "/path/to/rc/file"` | Use the specified rc file. | "$HOME/.dialogrc" |
|
|
111
|
+
| yes_label | `dialog.yes_label = "Sure"` | Use the specified label on the "Yes" button. | "Yes" |
|
|
112
|
+
| no_label | `dialog.no_label = "Nope"` | Use the specified label on the "No" button. | "No" |
|
|
113
|
+
| cancel_label | `dialog.cancel_label = "Forget"` | Use the specified label on the "Cancel" button. | "Cancel" |
|
|
114
|
+
| help_button | `dialog.help_button = true` | Include a "Help" button on the dialog. | false |
|
|
115
|
+
| help_label | `dialog.help_label = "What?"` | Use the specified label on the "Help" button. | "Help" |
|
|
116
|
+
| extra_button | `dialog.extra_button = true` | Include an "Extra" button on the dialog. | false |
|
|
117
|
+
| extra_label | `dialog.extra_label = "More"` | Use the specified label on the "Extra" button. | "Extra" |
|
|
118
|
+
| dialog_options | `dialog.dialog_options="any valid dialog option"` e.g. `dialog.dialog_options="--no-tags"` for checklist | Pass any valid dialog option. `man dialog` and look at the **OPTIONS** section. It is the caller's responsibility to specify correct options, no validation will be done | N/A |
|
|
119
|
+
|
|
120
|
+
## Widgets
|
|
121
|
+
|
|
122
|
+
The following dialog widgets are supported:
|
|
123
|
+
|
|
124
|
+
- buildlist
|
|
125
|
+
- calendar
|
|
126
|
+
- checklist
|
|
127
|
+
- editbox
|
|
128
|
+
- form
|
|
129
|
+
- fselect
|
|
130
|
+
- gauge
|
|
131
|
+
- infobox
|
|
132
|
+
- textbox
|
|
133
|
+
- inputbox
|
|
134
|
+
- menu
|
|
135
|
+
- msgbox
|
|
136
|
+
- passwordbox
|
|
137
|
+
- passwordform
|
|
138
|
+
- pause
|
|
139
|
+
- prgbox
|
|
140
|
+
- progressbox
|
|
141
|
+
- programbox
|
|
142
|
+
- radiolist
|
|
143
|
+
- timebox
|
|
144
|
+
- treeview
|
|
145
|
+
- yesno
|
|
146
|
+
|
|
147
|
+
### buildlist
|
|
148
|
+
|
|
149
|
+
A buildlist dialog displays two lists, side-by-side. The list on the left shows unselected items. The list on the right shows selected items. As items are selected or unselected, they move between the lists. The SPACE bar is used to
|
|
150
|
+
select or unselect an item.
|
|
151
|
+
|
|
152
|
+
Use a carriage return or the "OK" button to accept the current value in the selected-window and exit. The results are written using the order displayed in the selected-window. The caller is responsible to create the items properly.
|
|
153
|
+
|
|
154
|
+
returns an array of selected tags
|
|
155
|
+
```bash
|
|
156
|
+
result_array = dialog.buildlist(text="Text Goes Here", items, height=0, width=0, listheight=0)
|
|
157
|
+
```
|
|
158
|
+
- Please look at [buildlist.rb](samples/buildlist.rb) for an example.
|
|
159
|
+
|
|
160
|
+
### calendar
|
|
161
|
+
|
|
162
|
+
- Please look at [calendar.rb](samples/calendar.rb) for an example.
|
|
163
|
+
|
|
164
|
+
### checklist
|
|
165
|
+
|
|
166
|
+
- Please look at [checklist.rb](samples/checklist.rb) for an example.
|
|
167
|
+
|
|
168
|
+
### editbox
|
|
169
|
+
|
|
170
|
+
- Please look at [editbox.rb](samples/editbox.rb) for an example.
|
|
171
|
+
|
|
172
|
+
### form
|
|
173
|
+
|
|
174
|
+
- Please look at
|
|
175
|
+
[form1.rb](samples/form1.rb), [form2.rb](samples/form2.rb), [form3.rb](samples/form3.rb)
|
|
176
|
+
for examples.
|
|
177
|
+
|
|
178
|
+
### fselect
|
|
179
|
+
|
|
180
|
+
- Please look at [fselect.rb](samples/fselect.rb) for an example.
|
|
181
|
+
|
|
182
|
+
### gauge
|
|
183
|
+
|
|
184
|
+
- Please look at [gauge.rb](samples/gauge.rb) for an example.
|
|
185
|
+
|
|
186
|
+
### infobox
|
|
187
|
+
|
|
188
|
+
- Please look at [infobox.rb](samples/infobox.rb) for an example.
|
|
189
|
+
|
|
190
|
+
### textbox
|
|
191
|
+
- Please look at [textbox.rb](samples/textbox.rb) for an example.
|
|
192
|
+
|
|
193
|
+
### inputbox
|
|
194
|
+
|
|
195
|
+
- Please look at [inputbox.rb](samples/inputbox.rb) for an example.
|
|
196
|
+
|
|
197
|
+
### menu
|
|
198
|
+
|
|
199
|
+
- Please look at [menubox.rb](samples/menubox.rb) for an example.
|
|
200
|
+
|
|
201
|
+
### msgbox
|
|
202
|
+
|
|
203
|
+
- Please look at [msgbox.rb](samples/msgbox.rb) for an example.
|
|
204
|
+
|
|
205
|
+
### passwordbox
|
|
206
|
+
|
|
207
|
+
- Please look at [password.rb](samples/password.rb), [password2.rb](samples/password2.rb)
|
|
208
|
+
for examples.
|
|
209
|
+
|
|
210
|
+
### passwordform
|
|
211
|
+
|
|
212
|
+
- Please look at [passwordform.rb](samples/passwordform.rb) for an example.
|
|
213
|
+
|
|
214
|
+
### pause
|
|
215
|
+
|
|
216
|
+
- Please look at [pause.rb](samples/pause.rb) for an example.
|
|
217
|
+
|
|
218
|
+
### prgbox
|
|
219
|
+
|
|
220
|
+
- Please look at [prgbox.rb](samples/prgbox.rb) for an example.
|
|
221
|
+
|
|
222
|
+
### progressbox
|
|
223
|
+
|
|
224
|
+
- Please look at [progressbox.rb](samples/progressbox.rb) for an example.
|
|
225
|
+
|
|
226
|
+
### programbox
|
|
227
|
+
|
|
228
|
+
- Please look at [programbox.rb](samples/programbox.rb) for an example.
|
|
229
|
+
|
|
230
|
+
### radiolist
|
|
231
|
+
|
|
232
|
+
- Please look at [radiolist.rb](samples/radiolist.rb) for an example.
|
|
233
|
+
|
|
234
|
+
### timebox
|
|
235
|
+
|
|
236
|
+
- Please look at [timebox.rb](samples/timebox.rb) for an example.
|
|
237
|
+
|
|
238
|
+
### treeview
|
|
239
|
+
|
|
240
|
+
- Please look at [treeview.rb](samples/treeview.rb) for an example.
|
|
241
|
+
|
|
242
|
+
### yesno
|
|
243
|
+
|
|
244
|
+
- Please look at [yesno.rb](samples/yesno.rb) for an example.
|
|
245
|
+
|
|
246
|
+
## Dependencies
|
|
247
|
+
|
|
248
|
+
Mrdialog does not have dependencies on any other gems. The gems in Gemfile are
|
|
249
|
+
for development for building the gem.
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
## For Developers
|
|
253
|
+
|
|
254
|
+
Note: Pre-built `mrdialog-1.0.7.gem` is in the pkg directory
|
|
255
|
+
|
|
256
|
+
If you need to build the gem yourself:
|
|
257
|
+
|
|
258
|
+
Install bundler first:
|
|
259
|
+
```bash
|
|
260
|
+
gem install bundler
|
|
261
|
+
bundle install
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
- To build:
|
|
265
|
+
```bash
|
|
266
|
+
rake clean
|
|
267
|
+
rake gemspec
|
|
268
|
+
rake build
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Will create the gem inside the pkg directory
|
|
272
|
+
|
|
273
|
+
- To install the built gem:
|
|
274
|
+
```bash
|
|
275
|
+
sudo gem install --local pkg/mrdialog-1.0.7.gem
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
- To install using rake:
|
|
279
|
+
```bash
|
|
280
|
+
sudo rake install
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
- To install the gem to a specific directory:
|
|
284
|
+
```bash
|
|
285
|
+
GEM_HOME=/tmp gem install --local pkg/mrdialog-1.0.7.gem`
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
The gem will be installed in `/tmp/gems` directory
|
|
289
|
+
|
|
290
|
+
Please see the [Makefile](Makefile) for build and release commands
|
|
291
|
+
|
|
292
|
+
## License
|
|
293
|
+
|
|
294
|
+
License is MIT. Please look at the [LICENSE.txt](LICENSE.txt) file for details.
|