mrdialog 1.0.3 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog.md +21 -1
- data/Gemfile +3 -2
- data/LICENSE.txt +1 -1
- data/README.md +137 -76
- data/Rakefile +3 -3
- data/VERSION +1 -1
- data/lib/mrdialog/mrdialog.rb +89 -78
- data/mrdialog.gemspec +124 -0
- data/pkg/md5.txt +1 -1
- data/pkg/mrdialog-1.0.5.gem +0 -0
- data/samples/extra_button/buildlist.rb +89 -0
- data/samples/extra_button/calendar.rb +45 -0
- data/samples/extra_button/checklist.rb +84 -0
- data/samples/extra_button/form1.rb +101 -0
- data/samples/extra_button/fselect.rb +36 -0
- data/samples/extra_button/inputbox.rb +48 -0
- data/samples/extra_button/menubox.rb +85 -0
- data/samples/extra_button/password.rb +44 -0
- data/samples/extra_button/radiolist.rb +86 -0
- data/samples/extra_button/timebox.rb +43 -0
- data/samples/extra_button/treeview.rb +112 -0
- data/samples/run_all.rb +1 -1
- data/samples/yesno.rb +1 -1
- metadata +40 -16
- data/Gemfile.lock +0 -82
- data/pkg/mrdialog-1.0.3.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 071dc52f5772237e093be82215d7aa7faaced1ffdc3899c968712fb03522cddb
|
4
|
+
data.tar.gz: 92d8a468387d820e26df5915fbfb540fd8545ea616feb1fb261c8caa6f91207d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3256eac212b5f413a2f61fea246679657a89cf78c8fe01d880a705b0ef3c9d0628d044059de2554bafa05a441b8774911119837734d6620b3917b36176294686
|
7
|
+
data.tar.gz: d991bcddd1529d359bbc3c119ab09928834805eb78eb6101b598fcfd030bedcdbdee8aab9f1cccce10449369c75dd4763033e5a29dcca93004d8ae077dd5b90a
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,23 @@
|
|
1
|
+
## 1.0.5
|
2
|
+
* Wrap values inside single quotes indead of double quotes. If saved values
|
3
|
+
are reloaded in a form, special shell characters could get expanded and
|
4
|
+
corrupt data. Please update to v1.0.5.
|
5
|
+
(Mar-15-2023)
|
6
|
+
|
7
|
+
## 1.0.4
|
8
|
+
* Previously only the OK/Yes button read input from forms, menus and lists.
|
9
|
+
If an extra button is used, it was treated the same as the Cancel/No
|
10
|
+
button, and no output from the form/menu/list was returned to the caller.
|
11
|
+
|
12
|
+
This PR changes the various user input dialogs to treat the Extra button
|
13
|
+
the same way as the OK/Yes button, and to return the dialog's input to the
|
14
|
+
caller.
|
15
|
+
|
16
|
+
Thanks to https://github.com/OtherJohnGray for pull request.
|
17
|
+
|
18
|
+
(Jun-22-2022)
|
19
|
+
|
20
|
+
|
1
21
|
## 1.0.3
|
2
22
|
* Added accessor `rc_file`. It specifies the DIALOGRC file to use. Default is $HOME/.dialogrc
|
3
23
|
* Added accessor `cancel_label`. It specifies the label to use for the 'Cancel' button.
|
@@ -29,7 +49,7 @@ This ia exactly same as `dialog.notags = true`
|
|
29
49
|
|
30
50
|
## 1.0.1
|
31
51
|
|
32
|
-
*
|
52
|
+
* Juwelier support for making the gem.
|
33
53
|
|
34
54
|
Implemented methods for:
|
35
55
|
|
data/Gemfile
CHANGED
@@ -8,7 +8,8 @@ source "http://rubygems.org"
|
|
8
8
|
group :development do
|
9
9
|
gem "shoulda", ">= 0"
|
10
10
|
gem "rdoc", "~> 3.12"
|
11
|
-
gem "bundler", "
|
12
|
-
gem "
|
11
|
+
gem "bundler", ">= 2.0"
|
12
|
+
gem "juwelier", "~> 2.1.0"
|
13
13
|
gem "simplecov", ">= 0"
|
14
|
+
gem "test-unit"
|
14
15
|
end
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Copyright (c) Aleks Clarks, http://rdialog.rubyforge.org/
|
2
|
-
Copyright (c) 2016, Muhammad Muquit,
|
2
|
+
Copyright (c) 2016-2022, Muhammad Muquit, https://www.muquit.com/
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
a copy of this software and associated documentation files (the
|
data/README.md
CHANGED
@@ -1,192 +1,253 @@
|
|
1
1
|
### MRDialog
|
2
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.
|
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
6
|
[dialog](http://invisible-island.net/dialog/dialog.html) is
|
7
|
-
a command line tool that can present questions, messages, forms using
|
7
|
+
a command line tool that can present questions, messages, forms using
|
8
8
|
dialog boxes from a shell script. If you compiled linux kernel and typed 'make
|
9
9
|
menuconfig', configured Linux from command line with various configuration
|
10
10
|
managers, you have used 'dialog' like programs.
|
11
11
|
|
12
|
-
However, it is painful to program dialog from shell scripts due to lack of
|
13
|
-
data structure. You constantly have to watch if the correct number of
|
12
|
+
However, it is painful to program dialog from shell scripts due to lack of
|
13
|
+
data structure. You constantly have to watch if the correct number of
|
14
14
|
items are specified, if the arguments are in correct order for example. It is
|
15
|
-
a lot of fun to program dialog from an object oriented scripting language like
|
15
|
+
a lot of fun to program dialog from an object oriented scripting language like
|
16
16
|
[ruby](https://www.ruby-lang.org/). Compare the sample shell scripts of dialog program with
|
17
|
-
the sample ruby scripts of mrdialog in the [samples](samples/) directory, I think you will
|
18
|
-
agree.
|
17
|
+
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.
|
19
18
|
|
20
19
|
MRDialog is based on the rdialog ruby gem http://rdialog.rubyforge.org/ by
|
21
20
|
Aleks Clark.
|
22
21
|
|
23
22
|
I did the following:
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
- Added features and support for all of the missing widgets.
|
25
|
+
- Fixed the bugs I found.
|
26
|
+
- Implemented the examples for all the widgets.
|
28
27
|
|
29
|
-
If you have bug reports, questions, requests or
|
28
|
+
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.
|
30
29
|
|
31
30
|
### Latest Version
|
32
|
-
|
31
|
+
|
32
|
+
The latest version is 1.0.4.
|
33
33
|
Please look at the [ChangeLog.md](ChangeLog.md) file for details. Please look at he [screenshots](screenshots/) to see how the widgets look like.
|
34
34
|
|
35
35
|
### Screenshots
|
36
|
-
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.
|
37
36
|
|
37
|
+
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.
|
38
38
|
|
39
39
|
### Requirements
|
40
|
-
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```
|
41
40
|
|
42
|
-
|
41
|
+
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`
|
42
|
+
|
43
|
+
I tested with `dialog Version: 1.2-20130928`
|
43
44
|
|
44
45
|
dialog HOME: http://invisible-island.net/dialog/dialog.html.
|
45
46
|
|
46
47
|
### To install
|
47
48
|
|
48
|
-
|
49
|
+
`# gem install mrdialog`
|
49
50
|
or
|
50
|
-
|
51
|
+
`$ sudo gem install mrdialog`
|
52
|
+
|
51
53
|
### To uninstall
|
52
|
-
|
53
|
-
|
54
|
+
|
55
|
+
`# gem uninstall mrdialog` or `$ sudo gem uninstall mrdialog`
|
56
|
+
|
54
57
|
### Run the sample apps
|
58
|
+
|
55
59
|
Find out where the mrdialog gem is installed. Example:
|
56
60
|
|
57
61
|
$ gem which mrdialog
|
58
|
-
/
|
62
|
+
/Users/muquit/.rvm/gems/ruby-3.0.0/gems/mrdialog-1.0.4/lib/mrdialog.rb
|
59
63
|
|
60
|
-
|
64
|
+
`cd` to the `samples` directory and run the apps.
|
61
65
|
Example:
|
62
66
|
|
63
|
-
$ cd /
|
67
|
+
$ cd /Users/muquit/.rvm/gems/ruby-3.0.0/gems/mrdialog-1.0.4/samples
|
64
68
|
$ ./msgbox.rb
|
65
69
|
|
70
|
+
Look at samples/extra_button/ on how to use an extra button on various input
|
71
|
+
dialogs.
|
66
72
|
|
67
73
|
### How to use the API
|
68
|
-
|
74
|
+
|
75
|
+
For now, please look at the apps in [samples](samples/) directory to see how the API works.
|
69
76
|
|
70
77
|
require 'mrdialog'
|
71
78
|
dialog = MRDialog.new
|
72
79
|
|
73
80
|
#### Properties
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
81
|
+
|
82
|
+
The various properties of the dialog (shadow, title etc.) can be set by calling the appropriate setters. The supported properties are shown below:
|
83
|
+
|
84
|
+
| Property | Example | Description | Default |
|
85
|
+
| -------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
86
|
+
| shadow | `dialog.shadow = false` | Draw a shadow to the right and bottom of each dialog box. | true |
|
87
|
+
| title | `dialog.title = 'foo'` | Specifies a title string to be displayed at the top of the dialog box | N/A |
|
88
|
+
| logger | `dialog.logger = Logger.new("dialog.log")` | Debug messages will be logged to the specified ruby Logger | N/A |
|
89
|
+
| clear | `dialog.clear = true` | Clears the widget screen, keeping only the screen_color background. | false |
|
90
|
+
| insecure | `dialog.insecure = true` | Makes the password widget friendlier but less secure, by echoing asterisks for each character. | false |
|
91
|
+
| 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 |
|
92
|
+
| rc_file | `dialog.rc_file = "/path/to/rc/file"` | Use the specified rc file. | "$HOME/.dialogrc" |
|
93
|
+
| yes_label | `dialog.yes_label = "Sure"` | Use the specified label on the "Yes" button. | "Yes" |
|
94
|
+
| no_label | `dialog.no_label = "Nope"` | Use the specified label on the "No" button. | "No" |
|
95
|
+
| cancel_label | `dialog.cancel_label = "Forget"` | Use the specified label on the "Cancel" button. | "Cancel" |
|
96
|
+
| help_button | `dialog.help_button = true` | Include a "Help" button on the dialog. | false |
|
97
|
+
| help_label | `dialog.help_label = "What?"` | Use the specified label on the "Help" button. | "Help" |
|
98
|
+
| extra_button | `dialog.extra_button = true` | Include an "Extra" button on the dialog. | false |
|
99
|
+
| extra_label | `dialog.extra_label = "More"` | Use the specified label on the "Extra" button. | "Extra" |
|
100
|
+
| 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 |
|
93
101
|
|
94
102
|
#### Widgets
|
103
|
+
|
95
104
|
The following dialog widgets are supported:
|
96
105
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
106
|
+
- buildlist
|
107
|
+
- calendar
|
108
|
+
- checklist
|
109
|
+
- editbox
|
110
|
+
- form
|
111
|
+
- fselect
|
112
|
+
- gauge
|
113
|
+
- infobox
|
114
|
+
- inputbox
|
115
|
+
- menu
|
116
|
+
- msgbox
|
117
|
+
- passwordbox
|
118
|
+
- passwordform
|
119
|
+
- pause
|
120
|
+
- prgbox
|
121
|
+
- progressbox
|
122
|
+
- programbox
|
123
|
+
- radiolist
|
124
|
+
- timebox
|
125
|
+
- treeview
|
126
|
+
- yesno
|
127
|
+
|
119
128
|
##### buildlist
|
120
|
-
|
129
|
+
|
130
|
+
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
|
121
131
|
select or unselect an item.
|
122
132
|
|
123
|
-
Use a carriage return or the "OK" button to accept
|
133
|
+
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. Please look at [buildlist.rb](samples/buildlist.rb) for an example.
|
124
134
|
|
125
135
|
returns an array of selected tags
|
126
136
|
|
127
137
|
result_array = dialog.buildlist(text="Text Goes Here", items, height=0, width=0, listheight=0)
|
128
|
-
|
138
|
+
|
129
139
|
#### calendar
|
140
|
+
|
130
141
|
Please look at [calendar.rb](samples/calendar.rb) for an example.
|
142
|
+
|
131
143
|
#### checklist
|
144
|
+
|
132
145
|
Please look at [checklist.rb](samples/checklist.rb) for an example.
|
146
|
+
|
133
147
|
#### editbox
|
148
|
+
|
134
149
|
Please look at [editbox.rb](samples/editbox.rb) for an example.
|
150
|
+
|
135
151
|
#### form
|
136
|
-
|
137
|
-
|
152
|
+
|
153
|
+
Please look at
|
154
|
+
[form1.rb](samples/form1.rb), [form2.rb](samples/form2.rb), [form3.rb](samples/form3.rb)
|
138
155
|
for examples.
|
156
|
+
|
139
157
|
#### fselect
|
158
|
+
|
140
159
|
Please look at [fselect.rb](samples/fselect.rb) for an example.
|
160
|
+
|
141
161
|
#### gauge
|
162
|
+
|
142
163
|
Please look at [gauge.rb](samples/gauge.rb) for an example.
|
164
|
+
|
143
165
|
#### infobox
|
166
|
+
|
144
167
|
Please look at [infobox.rb](samples/infobox.rb) for an example.
|
168
|
+
|
145
169
|
#### inputbox
|
170
|
+
|
146
171
|
Please look at [inputbox.rb](samples/inputbox.rb) for an example.
|
172
|
+
|
147
173
|
#### menu
|
174
|
+
|
148
175
|
Please look at [menubox.rb](samples/menubox.rb) for an example.
|
176
|
+
|
149
177
|
#### msgbox
|
178
|
+
|
150
179
|
Please look at [msgbox.rb](samples/msgbox.rb) for an example.
|
180
|
+
|
151
181
|
#### passwordbox
|
182
|
+
|
152
183
|
Please look at [password.rb](samples/password.rb), [password2.rb](samples/password2.rb)
|
153
184
|
for examples.
|
185
|
+
|
154
186
|
#### passwordform
|
187
|
+
|
155
188
|
Please look at [passwordform.rb](samples/passwordform.rb) for an example.
|
189
|
+
|
156
190
|
#### pause
|
191
|
+
|
157
192
|
Please look at [pause.rb](samples/pause.rb) for an example.
|
193
|
+
|
158
194
|
#### prgbox
|
195
|
+
|
159
196
|
Please look at [prgbox.rb](samples/prgbox.rb) for an example.
|
197
|
+
|
160
198
|
#### progressbox
|
199
|
+
|
161
200
|
Please look at [progressbox.rb](samples/progressbox.rb) for an example.
|
201
|
+
|
162
202
|
#### programbox
|
203
|
+
|
163
204
|
Please look at [programbox.rb](samples/programbox.rb) for an example.
|
205
|
+
|
164
206
|
#### radiolist
|
207
|
+
|
165
208
|
Please look at [radiolist.rb](samples/radiolist.rb) for an example.
|
209
|
+
|
166
210
|
#### timebox
|
211
|
+
|
167
212
|
Please look at [timebox.rb](samples/timebox.rb) for an example.
|
213
|
+
|
168
214
|
#### treeview
|
215
|
+
|
169
216
|
Please look at [treeview.rb](samples/treeview.rb) for an example.
|
217
|
+
|
170
218
|
#### yesno
|
219
|
+
|
171
220
|
Please look at [yesno.rb](samples/yesno.rb) for an example.
|
172
221
|
|
222
|
+
### Dependencies
|
223
|
+
|
224
|
+
Mrdialog does not have dependencies on any other gems. The gems in Gemfile are
|
225
|
+
for development for building the gem.
|
226
|
+
|
227
|
+
|
173
228
|
### For Developers
|
229
|
+
|
230
|
+
Note: Pre-built mrdialog-1.0.4.gem is in the pkg directory
|
231
|
+
|
232
|
+
If you need to build the gem yourself:
|
233
|
+
|
174
234
|
Install bundler first:
|
175
235
|
|
176
236
|
$ gem install bundler
|
177
237
|
$ bundle install
|
178
238
|
|
179
|
-
- To build:
|
239
|
+
- To build: `$ rake build`
|
180
240
|
|
181
241
|
Will create the gem inside the pkg directory
|
182
242
|
|
183
|
-
- To install the built gem:
|
243
|
+
- To install the built gem: `$ sudo gem install --local pkg/mrdialog-1.0.4.gem`
|
184
244
|
|
185
|
-
- To install using rake:
|
245
|
+
- To install using rake: `$ sudo rake install`
|
186
246
|
|
187
|
-
- To install the gem to a specific directory:
|
247
|
+
- To install the gem to a specific directory: `$ GEM_HOME=/tmp gem install --local pkg/mrdialog-1.0.4.gem`
|
188
248
|
|
189
249
|
The gem will be installed in /tmp/gems directory
|
190
250
|
|
191
251
|
### Copyright
|
192
|
-
|
252
|
+
|
253
|
+
License is MIT. Please look at the [LICENSE.txt](LICENSE.txt) file for details.
|
data/Rakefile
CHANGED
@@ -11,8 +11,8 @@ rescue Bundler::BundlerError => e
|
|
11
11
|
end
|
12
12
|
require 'rake'
|
13
13
|
|
14
|
-
require '
|
15
|
-
|
14
|
+
require 'juwelier'
|
15
|
+
Juwelier::Tasks.new do |gem|
|
16
16
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
17
|
gem.name = "mrdialog"
|
18
18
|
gem.homepage = "http://github.com/muquit/mrdialog"
|
@@ -34,7 +34,7 @@ Jeweler::Tasks.new do |gem|
|
|
34
34
|
gem.files.include 'ChangeLog.md'
|
35
35
|
# dependencies defined in Gemfile
|
36
36
|
end
|
37
|
-
|
37
|
+
Juwelier::RubygemsDotOrgTasks.new
|
38
38
|
|
39
39
|
require 'rake/testtask'
|
40
40
|
Rake::TestTask.new(:test) do |test|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|