gloo 0.5.4 → 0.7.2
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/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/lib/gloo/app/args.rb +48 -6
- data/lib/gloo/app/engine.rb +60 -38
- data/lib/gloo/app/help.rb +137 -16
- data/lib/gloo/app/info.rb +3 -1
- data/lib/gloo/app/log.rb +23 -0
- data/lib/gloo/app/mode.rb +2 -0
- data/lib/gloo/app/settings.rb +98 -47
- data/lib/gloo/convert/converter.rb +35 -0
- data/lib/gloo/convert/string_to_datetime.rb +1 -1
- data/lib/gloo/convert/string_to_decimal.rb +1 -1
- data/lib/gloo/convert/string_to_integer.rb +1 -1
- data/lib/gloo/core/dictionary.rb +99 -22
- data/lib/gloo/core/error.rb +19 -8
- data/lib/gloo/core/event_manager.rb +4 -0
- data/lib/gloo/core/factory.rb +11 -0
- data/lib/gloo/core/gloo_system.rb +1 -1
- data/lib/gloo/core/heap.rb +11 -3
- data/lib/gloo/core/here.rb +36 -0
- data/lib/gloo/core/it.rb +6 -0
- data/lib/gloo/core/literal.rb +5 -0
- data/lib/gloo/core/obj.rb +22 -0
- data/lib/gloo/core/op.rb +7 -0
- data/lib/gloo/core/parser.rb +6 -0
- data/lib/gloo/core/pn.rb +38 -0
- data/lib/gloo/core/tokens.rb +66 -22
- data/lib/gloo/core/verb.rb +12 -0
- data/lib/gloo/exec/action.rb +48 -0
- data/lib/gloo/exec/dispatch.rb +15 -5
- data/lib/gloo/exec/exec_env.rb +74 -0
- data/lib/gloo/exec/runner.rb +4 -2
- data/lib/gloo/{core → exec}/script.rb +21 -9
- data/lib/gloo/exec/stack.rb +78 -0
- data/lib/gloo/expr/expression.rb +26 -4
- data/lib/gloo/expr/l_boolean.rb +6 -0
- data/lib/gloo/expr/l_decimal.rb +5 -0
- data/lib/gloo/expr/l_integer.rb +7 -0
- data/lib/gloo/expr/l_string.rb +7 -0
- data/lib/gloo/expr/op_div.rb +2 -0
- data/lib/gloo/expr/op_minus.rb +2 -0
- data/lib/gloo/expr/op_mult.rb +2 -0
- data/lib/gloo/expr/op_plus.rb +2 -0
- data/lib/gloo/help/app/application.txt +22 -0
- data/lib/gloo/help/app/configuration.txt +7 -0
- data/lib/gloo/help/app/default_help.txt +14 -0
- data/lib/gloo/help/app/logging.txt +16 -0
- data/lib/gloo/help/core/color.txt +31 -0
- data/lib/gloo/help/core/error.txt +33 -0
- data/lib/gloo/help/core/events.txt +21 -0
- data/lib/gloo/help/core/gloo_system.txt +54 -0
- data/lib/gloo/help/core/here.txt +30 -0
- data/lib/gloo/help/core/it.txt +23 -0
- data/lib/gloo/help/core/ops.txt +16 -0
- data/lib/gloo/help/core/pathname.txt +29 -0
- data/lib/gloo/help/objs/basic/alias.txt +36 -0
- data/lib/gloo/help/objs/basic/boolean.txt +28 -0
- data/lib/gloo/help/objs/basic/container.txt +33 -0
- data/lib/gloo/help/objs/basic/decimal.txt +28 -0
- data/lib/gloo/help/objs/basic/integer.txt +27 -0
- data/lib/gloo/help/objs/basic/script.txt +29 -0
- data/lib/gloo/help/objs/basic/string.txt +28 -0
- data/lib/gloo/help/objs/basic/text.txt +27 -0
- data/lib/gloo/help/objs/basic/untyped.txt +22 -0
- data/lib/gloo/help/objs/cli/banner.txt +49 -0
- data/lib/gloo/help/objs/cli/bar.txt +34 -0
- data/lib/gloo/help/objs/cli/colorize.txt +33 -0
- data/lib/gloo/help/objs/cli/confirm.txt +26 -0
- data/lib/gloo/help/objs/cli/menu.txt +44 -0
- data/lib/gloo/help/objs/cli/menu_item.txt +26 -0
- data/lib/gloo/help/objs/cli/pastel.txt +43 -0
- data/lib/gloo/help/objs/cli/prompt.txt +27 -0
- data/lib/gloo/help/objs/cli/select.txt +34 -0
- data/lib/gloo/help/objs/ctrl/each.txt +48 -0
- data/lib/gloo/help/objs/ctrl/repeat.txt +38 -0
- data/lib/gloo/help/objs/data/markdown.txt +25 -0
- data/lib/gloo/help/objs/data/table.txt +46 -0
- data/lib/gloo/help/objs/dev/git_repo.txt +35 -0
- data/lib/gloo/help/objs/dt/date.txt +23 -0
- data/lib/gloo/help/objs/dt/datetime.txt +24 -0
- data/lib/gloo/help/objs/dt/time.txt +23 -0
- data/lib/gloo/help/objs/ror/erb.txt +37 -0
- data/lib/gloo/help/objs/ror/eval.txt +24 -0
- data/lib/gloo/help/objs/snd/play.txt +23 -0
- data/lib/gloo/help/objs/snd/say.txt +28 -0
- data/lib/gloo/help/objs/system/file.txt +41 -0
- data/lib/gloo/help/objs/system/system.txt +32 -0
- data/lib/gloo/help/objs/web/http_get.txt +35 -0
- data/lib/gloo/help/objs/web/http_post.txt +32 -0
- data/lib/gloo/help/objs/web/json.txt +34 -0
- data/lib/gloo/help/objs/web/slack.txt +33 -0
- data/lib/gloo/help/objs/web/teams.txt +30 -0
- data/lib/gloo/help/objs/web/uri.txt +37 -0
- data/lib/gloo/help/verbs/alert.txt +33 -0
- data/lib/gloo/help/verbs/beep.txt +25 -0
- data/lib/gloo/help/verbs/cls.txt +24 -0
- data/lib/gloo/help/verbs/context.txt +43 -0
- data/lib/gloo/help/verbs/create.txt +33 -0
- data/lib/gloo/help/verbs/execute.txt +27 -0
- data/lib/gloo/help/verbs/help.txt +34 -0
- data/lib/gloo/help/verbs/if.txt +37 -0
- data/lib/gloo/help/verbs/list.txt +34 -0
- data/lib/gloo/help/verbs/load.txt +38 -0
- data/lib/gloo/help/verbs/move.txt +42 -0
- data/lib/gloo/help/verbs/put.txt +38 -0
- data/lib/gloo/help/verbs/quit.txt +25 -0
- data/lib/gloo/help/verbs/run.txt +41 -0
- data/lib/gloo/help/verbs/save.txt +26 -0
- data/lib/gloo/help/verbs/show.txt +30 -0
- data/lib/gloo/help/verbs/tell.txt +34 -0
- data/lib/gloo/help/verbs/unless.txt +38 -0
- data/lib/gloo/help/verbs/version.txt +32 -0
- data/lib/gloo/help/verbs/wait.txt +29 -0
- data/lib/gloo/objs/basic/alias.rb +0 -33
- data/lib/gloo/objs/basic/boolean.rb +6 -27
- data/lib/gloo/objs/basic/container.rb +0 -33
- data/lib/gloo/objs/basic/decimal.rb +8 -28
- data/lib/gloo/objs/basic/integer.rb +5 -26
- data/lib/gloo/objs/basic/script.rb +1 -27
- data/lib/gloo/objs/basic/string.rb +6 -26
- data/lib/gloo/objs/basic/text.rb +0 -25
- data/lib/gloo/objs/basic/untyped.rb +0 -26
- data/lib/gloo/objs/cli/banner.rb +0 -29
- data/lib/gloo/objs/cli/bar.rb +0 -29
- data/lib/gloo/objs/cli/colorize.rb +4 -34
- data/lib/gloo/objs/cli/confirm.rb +6 -36
- data/lib/gloo/objs/cli/menu.rb +6 -36
- data/lib/gloo/objs/cli/menu_item.rb +0 -33
- data/lib/gloo/objs/cli/pastel.rb +4 -27
- data/lib/gloo/objs/cli/prompt.rb +4 -28
- data/lib/gloo/objs/cli/select.rb +4 -31
- data/lib/gloo/objs/ctrl/each.rb +33 -33
- data/lib/gloo/objs/ctrl/repeat.rb +8 -29
- data/lib/gloo/objs/data/markdown.rb +0 -25
- data/lib/gloo/objs/data/table.rb +4 -32
- data/lib/gloo/objs/dev/git.rb +12 -30
- data/lib/gloo/objs/dt/date.rb +3 -25
- data/lib/gloo/objs/dt/datetime.rb +4 -26
- data/lib/gloo/objs/dt/time.rb +3 -25
- data/lib/gloo/objs/ror/erb.rb +11 -45
- data/lib/gloo/objs/ror/eval.rb +11 -38
- data/lib/gloo/objs/snd/play.rb +2 -25
- data/lib/gloo/objs/snd/say.rb +9 -31
- data/lib/gloo/objs/system/file_handle.rb +0 -38
- data/lib/gloo/objs/system/system.rb +16 -46
- data/lib/gloo/objs/web/http_get.rb +57 -83
- data/lib/gloo/objs/web/http_post.rb +8 -31
- data/lib/gloo/objs/web/json.rb +11 -31
- data/lib/gloo/objs/web/slack.rb +7 -34
- data/lib/gloo/objs/web/teams.rb +13 -48
- data/lib/gloo/objs/web/uri.rb +0 -29
- data/lib/gloo/persist/file_loader.rb +8 -0
- data/lib/gloo/persist/file_saver.rb +6 -0
- data/lib/gloo/persist/file_storage.rb +2 -0
- data/lib/gloo/persist/line_splitter.rb +2 -0
- data/lib/gloo/persist/persist_man.rb +6 -0
- data/lib/gloo/verbs/alert.rb +30 -44
- data/lib/gloo/verbs/beep.rb +0 -30
- data/lib/gloo/verbs/cls.rb +0 -30
- data/lib/gloo/verbs/context.rb +9 -39
- data/lib/gloo/verbs/create.rb +17 -32
- data/lib/gloo/verbs/execute.rb +52 -0
- data/lib/gloo/verbs/help.rb +151 -115
- data/lib/gloo/verbs/if.rb +46 -44
- data/lib/gloo/verbs/list.rb +36 -54
- data/lib/gloo/verbs/load.rb +8 -37
- data/lib/gloo/verbs/move.rb +12 -51
- data/lib/gloo/verbs/put.rb +28 -52
- data/lib/gloo/verbs/quit.rb +0 -31
- data/lib/gloo/verbs/run.rb +23 -39
- data/lib/gloo/verbs/save.rb +0 -33
- data/lib/gloo/verbs/show.rb +6 -31
- data/lib/gloo/verbs/tell.rb +31 -31
- data/lib/gloo/verbs/unless.rb +47 -46
- data/lib/gloo/verbs/version.rb +0 -30
- data/lib/gloo/verbs/wait.rb +0 -31
- metadata +79 -3
|
@@ -90,36 +90,10 @@ module Gloo
|
|
|
90
90
|
# Send the object the unload message.
|
|
91
91
|
#
|
|
92
92
|
def msg_run
|
|
93
|
-
s = Gloo::
|
|
93
|
+
s = Gloo::Exec::Script.new self
|
|
94
94
|
s.run
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
# ---------------------------------------------------------------------
|
|
98
|
-
# Help
|
|
99
|
-
# ---------------------------------------------------------------------
|
|
100
|
-
|
|
101
|
-
#
|
|
102
|
-
# Get help for this object type.
|
|
103
|
-
#
|
|
104
|
-
def self.help
|
|
105
|
-
return <<~TEXT
|
|
106
|
-
SCRIPT OBJECT TYPE
|
|
107
|
-
NAME: script
|
|
108
|
-
SHORTCUT: cmd
|
|
109
|
-
|
|
110
|
-
DESCRIPTION
|
|
111
|
-
An exectutable script.
|
|
112
|
-
|
|
113
|
-
CHILDREN
|
|
114
|
-
None
|
|
115
|
-
|
|
116
|
-
MESSAGES
|
|
117
|
-
run - Run the script.
|
|
118
|
-
The script can be run by telling the object or run.
|
|
119
|
-
It can all be executed with the run verb.
|
|
120
|
-
TEXT
|
|
121
|
-
end
|
|
122
|
-
|
|
123
97
|
end
|
|
124
98
|
end
|
|
125
99
|
end
|
|
@@ -43,14 +43,18 @@ module Gloo
|
|
|
43
43
|
return super + %w[up down size]
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
#
|
|
46
47
|
# Get the size of the string.
|
|
48
|
+
#
|
|
47
49
|
def msg_size
|
|
48
50
|
s = value.size
|
|
49
51
|
$engine.heap.it.set_to s
|
|
50
52
|
return s
|
|
51
53
|
end
|
|
52
54
|
|
|
55
|
+
#
|
|
53
56
|
# Convert string to upper case
|
|
57
|
+
#
|
|
54
58
|
def msg_up
|
|
55
59
|
s = value.upcase
|
|
56
60
|
set_value s
|
|
@@ -58,7 +62,9 @@ module Gloo
|
|
|
58
62
|
return s
|
|
59
63
|
end
|
|
60
64
|
|
|
65
|
+
#
|
|
61
66
|
# Convert string to lower case
|
|
67
|
+
#
|
|
62
68
|
def msg_down
|
|
63
69
|
s = value.downcase
|
|
64
70
|
set_value s
|
|
@@ -66,32 +72,6 @@ module Gloo
|
|
|
66
72
|
return s
|
|
67
73
|
end
|
|
68
74
|
|
|
69
|
-
# ---------------------------------------------------------------------
|
|
70
|
-
# Help
|
|
71
|
-
# ---------------------------------------------------------------------
|
|
72
|
-
|
|
73
|
-
#
|
|
74
|
-
# Get help for this object type.
|
|
75
|
-
#
|
|
76
|
-
def self.help
|
|
77
|
-
return <<~TEXT
|
|
78
|
-
STRING OBJECT TYPE
|
|
79
|
-
NAME: string
|
|
80
|
-
SHORTCUT: str
|
|
81
|
-
|
|
82
|
-
DESCRIPTION
|
|
83
|
-
A string value.
|
|
84
|
-
|
|
85
|
-
CHILDREN
|
|
86
|
-
None
|
|
87
|
-
|
|
88
|
-
MESSAGES
|
|
89
|
-
up - Convert the string to uppercase.
|
|
90
|
-
down - Convert the string to lowercase.
|
|
91
|
-
size - Get the size of the string.
|
|
92
|
-
TEXT
|
|
93
|
-
end
|
|
94
|
-
|
|
95
75
|
end
|
|
96
76
|
end
|
|
97
77
|
end
|
data/lib/gloo/objs/basic/text.rb
CHANGED
|
@@ -82,31 +82,6 @@ module Gloo
|
|
|
82
82
|
set_value File.read( tmp )
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
# ---------------------------------------------------------------------
|
|
86
|
-
# Help
|
|
87
|
-
# ---------------------------------------------------------------------
|
|
88
|
-
|
|
89
|
-
#
|
|
90
|
-
# Get help for this object type.
|
|
91
|
-
#
|
|
92
|
-
def self.help
|
|
93
|
-
return <<~TEXT
|
|
94
|
-
TEXT OBJECT TYPE
|
|
95
|
-
NAME: text
|
|
96
|
-
SHORTCUT: txt
|
|
97
|
-
|
|
98
|
-
DESCRIPTION
|
|
99
|
-
A longer, multi-line text string.
|
|
100
|
-
|
|
101
|
-
CHILDREN
|
|
102
|
-
None
|
|
103
|
-
|
|
104
|
-
MESSAGES
|
|
105
|
-
edit - Edit the text field in the default editor.
|
|
106
|
-
page - Show the text, paginated.
|
|
107
|
-
TEXT
|
|
108
|
-
end
|
|
109
|
-
|
|
110
85
|
end
|
|
111
86
|
end
|
|
112
87
|
end
|
|
@@ -36,32 +36,6 @@ module Gloo
|
|
|
36
36
|
return super # + [ "run" ]
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
# ---------------------------------------------------------------------
|
|
40
|
-
# Help
|
|
41
|
-
# ---------------------------------------------------------------------
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
# Get help for this object type.
|
|
45
|
-
#
|
|
46
|
-
def self.help
|
|
47
|
-
return <<~TEXT
|
|
48
|
-
UNTYPED OBJECT TYPE
|
|
49
|
-
NAME: untyped
|
|
50
|
-
SHORTCUT: un
|
|
51
|
-
|
|
52
|
-
DESCRIPTION
|
|
53
|
-
An untyped object.
|
|
54
|
-
If no type is specified when an object is created it
|
|
55
|
-
will be of this type.
|
|
56
|
-
|
|
57
|
-
CHILDREN
|
|
58
|
-
None
|
|
59
|
-
|
|
60
|
-
MESSAGES
|
|
61
|
-
None
|
|
62
|
-
TEXT
|
|
63
|
-
end
|
|
64
|
-
|
|
65
39
|
end
|
|
66
40
|
end
|
|
67
41
|
end
|
data/lib/gloo/objs/cli/banner.rb
CHANGED
|
@@ -103,35 +103,6 @@ module Gloo
|
|
|
103
103
|
puts pastel.decorate( t, *c )
|
|
104
104
|
end
|
|
105
105
|
|
|
106
|
-
# ---------------------------------------------------------------------
|
|
107
|
-
# Help
|
|
108
|
-
# ---------------------------------------------------------------------
|
|
109
|
-
|
|
110
|
-
#
|
|
111
|
-
# Get help for this object type.
|
|
112
|
-
#
|
|
113
|
-
def self.help
|
|
114
|
-
return <<~TEXT
|
|
115
|
-
BANNER OBJECT TYPE
|
|
116
|
-
NAME: banner
|
|
117
|
-
SHORTCUT: ban
|
|
118
|
-
|
|
119
|
-
DESCRIPTION
|
|
120
|
-
Banner text in large, colored font.
|
|
121
|
-
|
|
122
|
-
CHILDREN
|
|
123
|
-
text - string
|
|
124
|
-
The text for the banner.
|
|
125
|
-
style - string
|
|
126
|
-
The banner style. See tty-font for options.
|
|
127
|
-
color - string
|
|
128
|
-
The color for the banner. See pastel for options.
|
|
129
|
-
|
|
130
|
-
MESSAGES
|
|
131
|
-
show - Show the text banner.
|
|
132
|
-
TEXT
|
|
133
|
-
end
|
|
134
|
-
|
|
135
106
|
end
|
|
136
107
|
end
|
|
137
108
|
end
|
data/lib/gloo/objs/cli/bar.rb
CHANGED
|
@@ -107,35 +107,6 @@ module Gloo
|
|
|
107
107
|
@bar.advance x
|
|
108
108
|
end
|
|
109
109
|
|
|
110
|
-
# ---------------------------------------------------------------------
|
|
111
|
-
# Help
|
|
112
|
-
# ---------------------------------------------------------------------
|
|
113
|
-
|
|
114
|
-
#
|
|
115
|
-
# Get help for this object type.
|
|
116
|
-
#
|
|
117
|
-
def self.help
|
|
118
|
-
return <<~TEXT
|
|
119
|
-
BAR OBJECT TYPE
|
|
120
|
-
NAME: bar
|
|
121
|
-
SHORTCUT: bar
|
|
122
|
-
|
|
123
|
-
DESCRIPTION
|
|
124
|
-
CLI progress bar
|
|
125
|
-
|
|
126
|
-
CHILDREN
|
|
127
|
-
name - string
|
|
128
|
-
The name of the progress bar.
|
|
129
|
-
total - integer - 100
|
|
130
|
-
The total for the bar.
|
|
131
|
-
|
|
132
|
-
MESSAGES
|
|
133
|
-
start - Start the bar.
|
|
134
|
-
advance <amount> - Advance by the given amount.
|
|
135
|
-
stop - Complete the bar.
|
|
136
|
-
TEXT
|
|
137
|
-
end
|
|
138
|
-
|
|
139
110
|
end
|
|
140
111
|
end
|
|
141
112
|
end
|
|
@@ -42,10 +42,7 @@ module Gloo
|
|
|
42
42
|
# for default configurations.
|
|
43
43
|
def add_default_children
|
|
44
44
|
fac = $engine.factory
|
|
45
|
-
fac.
|
|
46
|
-
:type => 'string',
|
|
47
|
-
:value => '',
|
|
48
|
-
:parent => self } )
|
|
45
|
+
fac.create_string 'white', '', self
|
|
49
46
|
end
|
|
50
47
|
|
|
51
48
|
# ---------------------------------------------------------------------
|
|
@@ -59,7 +56,9 @@ module Gloo
|
|
|
59
56
|
return super + [ 'run' ]
|
|
60
57
|
end
|
|
61
58
|
|
|
62
|
-
#
|
|
59
|
+
#
|
|
60
|
+
# Run the colorize command.
|
|
61
|
+
#
|
|
63
62
|
def msg_run
|
|
64
63
|
msg = ''
|
|
65
64
|
children.each do |o|
|
|
@@ -69,35 +68,6 @@ module Gloo
|
|
|
69
68
|
$engine.heap.it.set_to msg.to_s
|
|
70
69
|
end
|
|
71
70
|
|
|
72
|
-
# ---------------------------------------------------------------------
|
|
73
|
-
# Help
|
|
74
|
-
# ---------------------------------------------------------------------
|
|
75
|
-
|
|
76
|
-
#
|
|
77
|
-
# Get help for this object type.
|
|
78
|
-
#
|
|
79
|
-
def self.help
|
|
80
|
-
return <<~TEXT
|
|
81
|
-
COLORIZE OBJECT TYPE
|
|
82
|
-
NAME: colorize
|
|
83
|
-
SHORTCUT: color
|
|
84
|
-
|
|
85
|
-
DESCRIPTION
|
|
86
|
-
The Colorize object can be used to write output in color.
|
|
87
|
-
The Colorize container can contain multiple strings, each
|
|
88
|
-
one can have a different color as specified by the names
|
|
89
|
-
of the children.
|
|
90
|
-
|
|
91
|
-
CHILDREN
|
|
92
|
-
<color> - string - no default value
|
|
93
|
-
The name of the child or children is the color.
|
|
94
|
-
The string's value is what will be written out.
|
|
95
|
-
|
|
96
|
-
MESSAGES
|
|
97
|
-
run - Output the string in the color specified.
|
|
98
|
-
TEXT
|
|
99
|
-
end
|
|
100
|
-
|
|
101
71
|
end
|
|
102
72
|
end
|
|
103
73
|
end
|
|
@@ -11,6 +11,7 @@ module Gloo
|
|
|
11
11
|
KEYWORD = 'confirm'.freeze
|
|
12
12
|
KEYWORD_SHORT = 'confirm'.freeze
|
|
13
13
|
PROMPT = 'prompt'.freeze
|
|
14
|
+
DEFAULT_PROMPT = '> '.freeze
|
|
14
15
|
RESULT = 'result'.freeze
|
|
15
16
|
|
|
16
17
|
#
|
|
@@ -64,14 +65,8 @@ module Gloo
|
|
|
64
65
|
# for default configurations.
|
|
65
66
|
def add_default_children
|
|
66
67
|
fac = $engine.factory
|
|
67
|
-
fac.
|
|
68
|
-
|
|
69
|
-
:value => '> ',
|
|
70
|
-
:parent => self } )
|
|
71
|
-
fac.create( { :name => 'result',
|
|
72
|
-
:type => 'boolean',
|
|
73
|
-
:value => nil,
|
|
74
|
-
:parent => self } )
|
|
68
|
+
fac.create_string PROMPT, DEFAULT_PROMPT, self
|
|
69
|
+
fac.create_bool RESULT, nil, self
|
|
75
70
|
end
|
|
76
71
|
|
|
77
72
|
# ---------------------------------------------------------------------
|
|
@@ -85,7 +80,9 @@ module Gloo
|
|
|
85
80
|
return super + [ 'run' ]
|
|
86
81
|
end
|
|
87
82
|
|
|
88
|
-
#
|
|
83
|
+
#
|
|
84
|
+
# Run the confirmation command.
|
|
85
|
+
#
|
|
89
86
|
def msg_run
|
|
90
87
|
prompt = prompt_value
|
|
91
88
|
return unless prompt
|
|
@@ -94,33 +91,6 @@ module Gloo
|
|
|
94
91
|
set_result result
|
|
95
92
|
end
|
|
96
93
|
|
|
97
|
-
# ---------------------------------------------------------------------
|
|
98
|
-
# Help
|
|
99
|
-
# ---------------------------------------------------------------------
|
|
100
|
-
|
|
101
|
-
#
|
|
102
|
-
# Get help for this object type.
|
|
103
|
-
#
|
|
104
|
-
def self.help
|
|
105
|
-
return <<~TEXT
|
|
106
|
-
CONFIRM OBJECT TYPE
|
|
107
|
-
NAME: confirm
|
|
108
|
-
SHORTCUT: confirm
|
|
109
|
-
|
|
110
|
-
DESCRIPTION
|
|
111
|
-
CLI confirmation prompt.
|
|
112
|
-
|
|
113
|
-
CHILDREN
|
|
114
|
-
prompt - string - '> '
|
|
115
|
-
The confirmation prompt.
|
|
116
|
-
result - boolean - none
|
|
117
|
-
The result of the prompt.
|
|
118
|
-
|
|
119
|
-
MESSAGES
|
|
120
|
-
run - Prompt the user and then set the result.
|
|
121
|
-
TEXT
|
|
122
|
-
end
|
|
123
|
-
|
|
124
94
|
end
|
|
125
95
|
end
|
|
126
96
|
end
|
data/lib/gloo/objs/cli/menu.rb
CHANGED
|
@@ -59,16 +59,20 @@ module Gloo
|
|
|
59
59
|
# Children
|
|
60
60
|
# ---------------------------------------------------------------------
|
|
61
61
|
|
|
62
|
+
#
|
|
62
63
|
# Does this object have children to add when an object
|
|
63
64
|
# is created in interactive mode?
|
|
64
65
|
# This does not apply during obj load, etc.
|
|
66
|
+
#
|
|
65
67
|
def add_children_on_create?
|
|
66
68
|
return true
|
|
67
69
|
end
|
|
68
70
|
|
|
71
|
+
#
|
|
69
72
|
# Add children to this object.
|
|
70
73
|
# This is used by containers to add children needed
|
|
71
74
|
# for default configurations.
|
|
75
|
+
#
|
|
72
76
|
def add_default_children
|
|
73
77
|
fac = $engine.factory
|
|
74
78
|
fac.create_string PROMPT, '> ', self
|
|
@@ -171,7 +175,7 @@ module Gloo
|
|
|
171
175
|
obj = find_child DEFAULT
|
|
172
176
|
return unless obj
|
|
173
177
|
|
|
174
|
-
s = Gloo::
|
|
178
|
+
s = Gloo::Exec::Script.new obj
|
|
175
179
|
s.run
|
|
176
180
|
end
|
|
177
181
|
|
|
@@ -193,44 +197,10 @@ module Gloo
|
|
|
193
197
|
script = obj.do_script
|
|
194
198
|
return unless script
|
|
195
199
|
|
|
196
|
-
s = Gloo::
|
|
200
|
+
s = Gloo::Exec::Script.new script
|
|
197
201
|
s.run
|
|
198
202
|
end
|
|
199
203
|
|
|
200
|
-
# ---------------------------------------------------------------------
|
|
201
|
-
# Help
|
|
202
|
-
# ---------------------------------------------------------------------
|
|
203
|
-
|
|
204
|
-
#
|
|
205
|
-
# Get help for this object type.
|
|
206
|
-
#
|
|
207
|
-
def self.help
|
|
208
|
-
return <<~TEXT
|
|
209
|
-
MENU OBJECT TYPE
|
|
210
|
-
NAME: menu
|
|
211
|
-
SHORTCUT: menu
|
|
212
|
-
|
|
213
|
-
DESCRIPTION
|
|
214
|
-
A CLI menu.
|
|
215
|
-
This can be used for the main loop of a CLI application.
|
|
216
|
-
|
|
217
|
-
CHILDREN
|
|
218
|
-
prompt - string - '> '
|
|
219
|
-
The shortcut may be used to select the menu item.
|
|
220
|
-
items - container
|
|
221
|
-
A textual description of the menu item action.
|
|
222
|
-
loop - boolean
|
|
223
|
-
The script that will be run if the menu item is selected.
|
|
224
|
-
default - script
|
|
225
|
-
Optional script element. Run this if no other option selected.
|
|
226
|
-
|
|
227
|
-
MESSAGES
|
|
228
|
-
run - Show the options and the the prompt.
|
|
229
|
-
Then run the script for the user's selection.
|
|
230
|
-
Optionally repeat as long as the loop child is true.
|
|
231
|
-
TEXT
|
|
232
|
-
end
|
|
233
|
-
|
|
234
204
|
end
|
|
235
205
|
end
|
|
236
206
|
end
|
|
@@ -90,39 +90,6 @@ module Gloo
|
|
|
90
90
|
return super
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
# ---------------------------------------------------------------------
|
|
94
|
-
# Help
|
|
95
|
-
# ---------------------------------------------------------------------
|
|
96
|
-
|
|
97
|
-
#
|
|
98
|
-
# Get help for this object type.
|
|
99
|
-
#
|
|
100
|
-
def self.help
|
|
101
|
-
return <<~TEXT
|
|
102
|
-
MENU_ITEM OBJECT TYPE
|
|
103
|
-
NAME: menu_item
|
|
104
|
-
SHORTCUT: mitem
|
|
105
|
-
|
|
106
|
-
DESCRIPTION
|
|
107
|
-
A CLI menu item. One element in a CLI menu.
|
|
108
|
-
|
|
109
|
-
CHILDREN
|
|
110
|
-
shortcut - string
|
|
111
|
-
The shortcut may be used to select the menu item.
|
|
112
|
-
The shortcut child is optional. If it is not provided,
|
|
113
|
-
the name of the menu item will be used instead.
|
|
114
|
-
description - string
|
|
115
|
-
A textual description of the menu item action.
|
|
116
|
-
The description child is optional. If it is not provided,
|
|
117
|
-
the value of the menu item will be used instead.
|
|
118
|
-
do - script
|
|
119
|
-
The script that will be run if the menu item is selected.
|
|
120
|
-
|
|
121
|
-
MESSAGES
|
|
122
|
-
None
|
|
123
|
-
TEXT
|
|
124
|
-
end
|
|
125
|
-
|
|
126
93
|
end
|
|
127
94
|
end
|
|
128
95
|
end
|