gloo-lang 0.9.0 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. checksums.yaml +4 -4
  2. data/lib/VERSION +1 -1
  3. data/lib/dependencies.rb +2 -2
  4. data/lib/{gloo_lang.rb → gloo-lang.rb} +7 -9
  5. data/lib/gloo_lang/app/args.rb +112 -0
  6. data/lib/gloo_lang/app/engine.rb +230 -0
  7. data/lib/gloo_lang/app/help.rb +156 -0
  8. data/lib/gloo_lang/app/log.rb +81 -0
  9. data/lib/gloo_lang/app/mode.rb +27 -0
  10. data/lib/gloo_lang/app/settings.rb +186 -0
  11. data/lib/gloo_lang/convert/converter.rb +35 -0
  12. data/lib/gloo_lang/convert/string_to_datetime.rb +21 -0
  13. data/lib/gloo_lang/convert/string_to_decimal.rb +20 -0
  14. data/lib/gloo_lang/convert/string_to_integer.rb +20 -0
  15. data/lib/gloo_lang/core/baseo.rb +30 -0
  16. data/lib/gloo_lang/core/dictionary.rb +181 -0
  17. data/lib/gloo_lang/core/error.rb +61 -0
  18. data/lib/gloo_lang/core/event_manager.rb +44 -0
  19. data/lib/gloo_lang/core/factory.rb +210 -0
  20. data/lib/gloo_lang/core/gloo_system.rb +266 -0
  21. data/lib/gloo_lang/core/heap.rb +52 -0
  22. data/lib/gloo_lang/core/here.rb +36 -0
  23. data/lib/gloo_lang/core/it.rb +36 -0
  24. data/lib/gloo_lang/core/literal.rb +30 -0
  25. data/lib/gloo_lang/core/obj.rb +303 -0
  26. data/lib/gloo_lang/core/obj_finder.rb +30 -0
  27. data/lib/gloo_lang/core/op.rb +40 -0
  28. data/lib/gloo_lang/core/parser.rb +59 -0
  29. data/lib/gloo_lang/core/pn.rb +188 -0
  30. data/lib/gloo_lang/core/tokens.rb +165 -0
  31. data/lib/gloo_lang/core/verb.rb +86 -0
  32. data/lib/gloo_lang/exec/action.rb +48 -0
  33. data/lib/gloo_lang/exec/dispatch.rb +40 -0
  34. data/lib/gloo_lang/exec/exec_env.rb +74 -0
  35. data/lib/gloo_lang/exec/runner.rb +45 -0
  36. data/lib/gloo_lang/exec/script.rb +49 -0
  37. data/lib/gloo_lang/exec/stack.rb +78 -0
  38. data/lib/gloo_lang/expr/expression.rb +118 -0
  39. data/lib/gloo_lang/expr/l_boolean.rb +36 -0
  40. data/lib/gloo_lang/expr/l_decimal.rb +39 -0
  41. data/lib/gloo_lang/expr/l_integer.rb +37 -0
  42. data/lib/gloo_lang/expr/l_string.rb +58 -0
  43. data/lib/gloo_lang/expr/op_div.rb +22 -0
  44. data/lib/gloo_lang/expr/op_minus.rb +22 -0
  45. data/lib/gloo_lang/expr/op_mult.rb +22 -0
  46. data/lib/gloo_lang/expr/op_plus.rb +24 -0
  47. data/lib/gloo_lang/help/app/application.txt +22 -0
  48. data/lib/gloo_lang/help/app/configuration.txt +7 -0
  49. data/lib/gloo_lang/help/app/default_help.txt +14 -0
  50. data/lib/gloo_lang/help/app/logging.txt +16 -0
  51. data/lib/gloo_lang/help/core/color.txt +31 -0
  52. data/lib/gloo_lang/help/core/error.txt +33 -0
  53. data/lib/gloo_lang/help/core/events.txt +21 -0
  54. data/lib/gloo_lang/help/core/gloo_system.txt +57 -0
  55. data/lib/gloo_lang/help/core/here.txt +30 -0
  56. data/lib/gloo_lang/help/core/it.txt +23 -0
  57. data/lib/gloo_lang/help/core/ops.txt +16 -0
  58. data/lib/gloo_lang/help/core/pathname.txt +29 -0
  59. data/lib/gloo_lang/help/objs/basic/alias.txt +36 -0
  60. data/lib/gloo_lang/help/objs/basic/boolean.txt +28 -0
  61. data/lib/gloo_lang/help/objs/basic/container.txt +33 -0
  62. data/lib/gloo_lang/help/objs/basic/decimal.txt +28 -0
  63. data/lib/gloo_lang/help/objs/basic/integer.txt +27 -0
  64. data/lib/gloo_lang/help/objs/basic/script.txt +29 -0
  65. data/lib/gloo_lang/help/objs/basic/string.txt +28 -0
  66. data/lib/gloo_lang/help/objs/basic/text.txt +27 -0
  67. data/lib/gloo_lang/help/objs/basic/untyped.txt +22 -0
  68. data/lib/gloo_lang/help/objs/cli/banner.txt +49 -0
  69. data/lib/gloo_lang/help/objs/cli/bar.txt +37 -0
  70. data/lib/gloo_lang/help/objs/cli/colorize.txt +33 -0
  71. data/lib/gloo_lang/help/objs/cli/confirm.txt +26 -0
  72. data/lib/gloo_lang/help/objs/cli/menu.txt +44 -0
  73. data/lib/gloo_lang/help/objs/cli/menu_item.txt +26 -0
  74. data/lib/gloo_lang/help/objs/cli/pastel.txt +43 -0
  75. data/lib/gloo_lang/help/objs/cli/prompt.txt +27 -0
  76. data/lib/gloo_lang/help/objs/cli/select.txt +34 -0
  77. data/lib/gloo_lang/help/objs/ctrl/each.txt +48 -0
  78. data/lib/gloo_lang/help/objs/ctrl/repeat.txt +38 -0
  79. data/lib/gloo_lang/help/objs/data/markdown.txt +25 -0
  80. data/lib/gloo_lang/help/objs/data/mysql.txt +40 -0
  81. data/lib/gloo_lang/help/objs/data/query.txt +37 -0
  82. data/lib/gloo_lang/help/objs/data/sqlite.txt +26 -0
  83. data/lib/gloo_lang/help/objs/data/table.txt +46 -0
  84. data/lib/gloo_lang/help/objs/dev/git_repo.txt +36 -0
  85. data/lib/gloo_lang/help/objs/dev/stats.txt +36 -0
  86. data/lib/gloo_lang/help/objs/dt/date.txt +23 -0
  87. data/lib/gloo_lang/help/objs/dt/datetime.txt +24 -0
  88. data/lib/gloo_lang/help/objs/dt/time.txt +23 -0
  89. data/lib/gloo_lang/help/objs/ror/erb.txt +37 -0
  90. data/lib/gloo_lang/help/objs/ror/eval.txt +24 -0
  91. data/lib/gloo_lang/help/objs/snd/play.txt +23 -0
  92. data/lib/gloo_lang/help/objs/snd/say.txt +28 -0
  93. data/lib/gloo_lang/help/objs/system/file.txt +48 -0
  94. data/lib/gloo_lang/help/objs/system/ssh_exec.txt +30 -0
  95. data/lib/gloo_lang/help/objs/system/system.txt +32 -0
  96. data/lib/gloo_lang/help/objs/web/http_get.txt +35 -0
  97. data/lib/gloo_lang/help/objs/web/http_post.txt +34 -0
  98. data/lib/gloo_lang/help/objs/web/json.txt +34 -0
  99. data/lib/gloo_lang/help/objs/web/slack.txt +33 -0
  100. data/lib/gloo_lang/help/objs/web/teams.txt +30 -0
  101. data/lib/gloo_lang/help/objs/web/uri.txt +38 -0
  102. data/lib/gloo_lang/help/verbs/alert.txt +33 -0
  103. data/lib/gloo_lang/help/verbs/beep.txt +25 -0
  104. data/lib/gloo_lang/help/verbs/cls.txt +24 -0
  105. data/lib/gloo_lang/help/verbs/context.txt +43 -0
  106. data/lib/gloo_lang/help/verbs/create.txt +33 -0
  107. data/lib/gloo_lang/help/verbs/execute.txt +27 -0
  108. data/lib/gloo_lang/help/verbs/help.txt +34 -0
  109. data/lib/gloo_lang/help/verbs/if.txt +37 -0
  110. data/lib/gloo_lang/help/verbs/list.txt +34 -0
  111. data/lib/gloo_lang/help/verbs/load.txt +38 -0
  112. data/lib/gloo_lang/help/verbs/move.txt +42 -0
  113. data/lib/gloo_lang/help/verbs/put.txt +38 -0
  114. data/lib/gloo_lang/help/verbs/quit.txt +25 -0
  115. data/lib/gloo_lang/help/verbs/run.txt +41 -0
  116. data/lib/gloo_lang/help/verbs/save.txt +26 -0
  117. data/lib/gloo_lang/help/verbs/show.txt +30 -0
  118. data/lib/gloo_lang/help/verbs/tell.txt +34 -0
  119. data/lib/gloo_lang/help/verbs/unless.txt +38 -0
  120. data/lib/gloo_lang/help/verbs/version.txt +32 -0
  121. data/lib/gloo_lang/help/verbs/wait.txt +29 -0
  122. data/lib/gloo_lang/objs/basic/alias.rb +78 -0
  123. data/lib/gloo_lang/objs/basic/boolean.rb +120 -0
  124. data/lib/gloo_lang/objs/basic/container.rb +76 -0
  125. data/lib/gloo_lang/objs/basic/decimal.rb +76 -0
  126. data/lib/gloo_lang/objs/basic/integer.rb +73 -0
  127. data/lib/gloo_lang/objs/basic/script.rb +99 -0
  128. data/lib/gloo_lang/objs/basic/string.rb +77 -0
  129. data/lib/gloo_lang/objs/basic/text.rb +87 -0
  130. data/lib/gloo_lang/objs/basic/untyped.rb +41 -0
  131. data/lib/gloo_lang/objs/cli/banner.rb +108 -0
  132. data/lib/gloo_lang/objs/cli/bar.rb +133 -0
  133. data/lib/gloo_lang/objs/cli/colorize.rb +73 -0
  134. data/lib/gloo_lang/objs/cli/confirm.rb +96 -0
  135. data/lib/gloo_lang/objs/cli/menu.rb +206 -0
  136. data/lib/gloo_lang/objs/cli/menu_item.rb +95 -0
  137. data/lib/gloo_lang/objs/cli/pastel.rb +97 -0
  138. data/lib/gloo_lang/objs/cli/prompt.rb +110 -0
  139. data/lib/gloo_lang/objs/cli/select.rb +126 -0
  140. data/lib/gloo_lang/objs/ctrl/each.rb +279 -0
  141. data/lib/gloo_lang/objs/ctrl/repeat.rb +108 -0
  142. data/lib/gloo_lang/objs/data/markdown.rb +84 -0
  143. data/lib/gloo_lang/objs/data/mysql.rb +192 -0
  144. data/lib/gloo_lang/objs/data/query.rb +176 -0
  145. data/lib/gloo_lang/objs/data/sqlite.rb +159 -0
  146. data/lib/gloo_lang/objs/data/table.rb +140 -0
  147. data/lib/gloo_lang/objs/dev/git.rb +140 -0
  148. data/lib/gloo_lang/objs/dev/stats.rb +120 -0
  149. data/lib/gloo_lang/objs/dt/date.rb +50 -0
  150. data/lib/gloo_lang/objs/dt/datetime.rb +62 -0
  151. data/lib/gloo_lang/objs/dt/time.rb +50 -0
  152. data/lib/gloo_lang/objs/ror/erb.rb +116 -0
  153. data/lib/gloo_lang/objs/ror/eval.rb +107 -0
  154. data/lib/gloo_lang/objs/snd/play.rb +48 -0
  155. data/lib/gloo_lang/objs/snd/say.rb +98 -0
  156. data/lib/gloo_lang/objs/system/file_handle.rb +138 -0
  157. data/lib/gloo_lang/objs/system/ssh_exec.rb +126 -0
  158. data/lib/gloo_lang/objs/system/system.rb +136 -0
  159. data/lib/gloo_lang/objs/web/http_get.rb +159 -0
  160. data/lib/gloo_lang/objs/web/http_post.rb +183 -0
  161. data/lib/gloo_lang/objs/web/json.rb +135 -0
  162. data/lib/gloo_lang/objs/web/slack.rb +130 -0
  163. data/lib/gloo_lang/objs/web/teams.rb +117 -0
  164. data/lib/gloo_lang/objs/web/uri.rb +148 -0
  165. data/lib/gloo_lang/persist/file_loader.rb +191 -0
  166. data/lib/gloo_lang/persist/file_saver.rb +49 -0
  167. data/lib/gloo_lang/persist/file_storage.rb +45 -0
  168. data/lib/gloo_lang/persist/line_splitter.rb +81 -0
  169. data/lib/gloo_lang/persist/persist_man.rb +120 -0
  170. data/lib/gloo_lang/utils/format.rb +21 -0
  171. data/lib/gloo_lang/utils/stats.rb +205 -0
  172. data/lib/gloo_lang/utils/words.rb +19 -0
  173. data/lib/gloo_lang/verbs/alert.rb +79 -0
  174. data/lib/gloo_lang/verbs/beep.rb +40 -0
  175. data/lib/gloo_lang/verbs/cls.rb +37 -0
  176. data/lib/gloo_lang/verbs/context.rb +62 -0
  177. data/lib/gloo_lang/verbs/create.rb +68 -0
  178. data/lib/gloo_lang/verbs/execute.rb +56 -0
  179. data/lib/gloo_lang/verbs/help.rb +264 -0
  180. data/lib/gloo_lang/verbs/if.rb +92 -0
  181. data/lib/gloo_lang/verbs/list.rb +98 -0
  182. data/lib/gloo_lang/verbs/load.rb +45 -0
  183. data/lib/gloo_lang/verbs/move.rb +89 -0
  184. data/lib/gloo_lang/verbs/put.rb +94 -0
  185. data/lib/gloo_lang/verbs/quit.rb +40 -0
  186. data/lib/gloo_lang/verbs/run.rb +75 -0
  187. data/lib/gloo_lang/verbs/save.rb +39 -0
  188. data/lib/gloo_lang/verbs/show.rb +64 -0
  189. data/lib/gloo_lang/verbs/tell.rb +79 -0
  190. data/lib/gloo_lang/verbs/unless.rb +92 -0
  191. data/lib/gloo_lang/verbs/version.rb +37 -0
  192. data/lib/gloo_lang/verbs/wait.rb +42 -0
  193. metadata +191 -3
@@ -0,0 +1,28 @@
1
+ DECIMAL OBJECT TYPE
2
+ NAME: decimal
3
+ SHORTCUT: num
4
+
5
+ DESCRIPTION
6
+ A decimal (numeric) value.
7
+
8
+ CHILDREN
9
+ None
10
+
11
+ MESSAGES
12
+ round - Round to the nearest whole value.
13
+ If an optional parameter is included, round to the
14
+ precision specified.
15
+
16
+ EXAMPLE
17
+
18
+ d [can] :
19
+ x [decimal] : 100
20
+ on_load [script] :
21
+ show d.x
22
+ put d.x / 3 into d.x
23
+ show d.x
24
+ tell d.x to round (1)
25
+ show d.x
26
+
27
+ SEE ALSO
28
+ integer
@@ -0,0 +1,27 @@
1
+ INTEGER OBJECT TYPE
2
+ NAME: integer
3
+ SHORTCUT: int
4
+
5
+ DESCRIPTION
6
+ An integer (numeric) value.
7
+
8
+ CHILDREN
9
+ None
10
+
11
+ MESSAGES
12
+ inc - Increment the integer value by 1.
13
+ dec - Decrement the integer value by 1.
14
+
15
+ EXAMPLE
16
+
17
+ i [can] :
18
+ x [integer] : 0
19
+ on_load [script] :
20
+ show i.x
21
+ tell i.x to inc
22
+ show i.x
23
+ put i.x * 10 into i.x
24
+ show i.x
25
+
26
+ SEE ALSO
27
+ decimal
@@ -0,0 +1,29 @@
1
+ SCRIPT OBJECT TYPE
2
+ NAME: script
3
+ SHORTCUT: cmd
4
+
5
+ DESCRIPTION
6
+ An exectutable script.
7
+
8
+ CHILDREN
9
+ None
10
+
11
+ MESSAGES
12
+ run - Run the script.
13
+ The script can be run by telling the object or run.
14
+ It can all be executed with the run verb.
15
+
16
+ EXAMPLE
17
+
18
+ script [can] :
19
+ on_load [script] :
20
+ show "Showing multiple lines..."
21
+ show script.msg1
22
+ show script.msg2
23
+ show script.msg3
24
+ show "Done."
25
+ msg1 [string] : one
26
+ msg2 [string] : two
27
+ msg3 [string] : three
28
+
29
+ SEE ALSO
@@ -0,0 +1,28 @@
1
+ STRING OBJECT TYPE
2
+ NAME: string
3
+ SHORTCUT: str
4
+
5
+ DESCRIPTION
6
+ A string value.
7
+
8
+ CHILDREN
9
+ None
10
+
11
+ MESSAGES
12
+ up - Convert the string to uppercase.
13
+ down - Convert the string to lowercase.
14
+ size - Get the size of the string.
15
+
16
+ EXAMPLE
17
+
18
+ s [can] :
19
+ msg [string] : Hello World!
20
+ on_load [script] :
21
+ show s.msg
22
+ tell s.msg to up
23
+ show s.msg
24
+ tell s.msg to size
25
+ show it
26
+
27
+ SEE ALSO
28
+ text
@@ -0,0 +1,27 @@
1
+ TEXT OBJECT TYPE
2
+ NAME: text
3
+ SHORTCUT: txt
4
+
5
+ DESCRIPTION
6
+ A longer, multi-line text string.
7
+ Use BEGIN and END to mark the text range.
8
+
9
+ CHILDREN
10
+ None
11
+
12
+ MESSAGES
13
+ edit - Edit the text field in the default editor.
14
+ page - Show the text, paginated.
15
+
16
+ EXAMPLE
17
+
18
+ t [container] :
19
+ msg [txt] : BEGIN
20
+ I will now write a poem
21
+ of two lines or less
22
+ END
23
+ on_load [script] :
24
+ show t.msg
25
+
26
+ SEE ALSO
27
+ string
@@ -0,0 +1,22 @@
1
+ UNTYPED OBJECT TYPE
2
+ NAME: untyped
3
+ SHORTCUT: un
4
+
5
+ DESCRIPTION
6
+ An untyped object.
7
+ If no type is specified when an object is created it
8
+ will be of this type.
9
+
10
+ CHILDREN
11
+ None
12
+
13
+ MESSAGES
14
+ None
15
+
16
+ EXAMPLE
17
+
18
+ > create x
19
+ > put 1 into x
20
+ > put 'string' into x
21
+
22
+ SEE ALSO
@@ -0,0 +1,49 @@
1
+ BANNER OBJECT TYPE
2
+ NAME: banner
3
+ SHORTCUT: ban
4
+
5
+ DESCRIPTION
6
+ Banner text in large, colored font.
7
+
8
+ CHILDREN
9
+ text - string
10
+ The text for the banner.
11
+ style - string
12
+ The banner style. See tty-font for options.
13
+ color - string
14
+ The color for the banner. See pastel for options.
15
+
16
+ MESSAGES
17
+ show - Show the text banner.
18
+
19
+ EXAMPLE
20
+
21
+ ban [can] :
22
+ on_load [script] :
23
+ tell ban.one to show
24
+ tell ban.two to show
25
+ tell ban.three to show
26
+ tell ban.four to show
27
+ tell ban.five to show
28
+ one [banner] :
29
+ text [string] : Something New
30
+ style [string] : standard
31
+ color [string] : white on_green
32
+ two [banner] :
33
+ text [string] : Star Wars
34
+ style [string] : starwars
35
+ color [string] : red
36
+ three [banner] :
37
+ text [string] : Many_Dimensions
38
+ style [string] : 3d
39
+ color [string] : blue
40
+ four [banner] :
41
+ text [string] : As An Arrow
42
+ style [string] : straight
43
+ color [string] : yellow
44
+ five [banner] :
45
+ text [string] : Cranium
46
+ style [string] : block
47
+ color [string] : white on_yellow
48
+
49
+ SEE ALSO
@@ -0,0 +1,37 @@
1
+ BAR OBJECT TYPE
2
+ NAME: bar
3
+ SHORTCUT: bar
4
+
5
+ DESCRIPTION
6
+ CLI progress bar
7
+
8
+ CHILDREN
9
+ name - string
10
+ The name of the progress bar.
11
+ total - integer - 100
12
+ The total for the bar.
13
+
14
+ MESSAGES
15
+ start - Start the bar.
16
+ advance <amount> - Advance by the given amount.
17
+ stop - Complete the bar.
18
+ run <seconds> - Run for the given number of seconds
19
+ and advance the bar so that it completes at the end
20
+ of the time specified.
21
+
22
+ EXAMPLE
23
+
24
+ bar [can] :
25
+ on_load [script] :
26
+ tell bar.progress to start
27
+ tell bar.progress to advance
28
+ wait
29
+ tell bar.progress to advance (30)
30
+ wait
31
+ tell bar.progress to advance (40)
32
+ wait
33
+ tell bar.progress to stop
34
+ progress [bar] :
35
+ name [string] : going
36
+
37
+ SEE ALSO
@@ -0,0 +1,33 @@
1
+ COLORIZE OBJECT TYPE
2
+ NAME: colorize
3
+ SHORTCUT: color
4
+
5
+ DESCRIPTION
6
+ The Colorize object can be used to write output in color.
7
+ The Colorize container can contain multiple strings, each
8
+ one can have a different color as specified by the names
9
+ of the children.
10
+
11
+ CHILDREN
12
+ <color> - string - no default value
13
+ The name of the child or children is the color.
14
+ The string's value is what will be written out.
15
+
16
+ MESSAGES
17
+ run - Output the string in the color specified.
18
+
19
+ EXAMPLE
20
+
21
+ color [can] :
22
+ w [colorize] :
23
+ white [string] : This is white!
24
+ m [colorize] :
25
+ red [string] : red -
26
+ green [string] : green -
27
+ blue [string] : blue
28
+ on_load [script] :
29
+ run color.w
30
+ run color.m
31
+
32
+ SEE ALSO
33
+ pastel
@@ -0,0 +1,26 @@
1
+ CONFIRM OBJECT TYPE
2
+ NAME: confirm
3
+ SHORTCUT: confirm
4
+
5
+ DESCRIPTION
6
+ CLI confirmation prompt.
7
+
8
+ CHILDREN
9
+ prompt - string - '> '
10
+ The confirmation prompt.
11
+ result - boolean - none
12
+ The result of the prompt.
13
+
14
+ MESSAGES
15
+ run - Prompt the user and then set the result.
16
+
17
+ EXAMPLE
18
+
19
+ confirm [confirm] :
20
+ prompt [string] : Are you sure?
21
+ result [boolean] :
22
+ on_load [script] :
23
+ run confirm
24
+ show 'Confirmed: ' + confirm.result
25
+
26
+ SEE ALSO
@@ -0,0 +1,44 @@
1
+ MENU OBJECT TYPE
2
+ NAME: menu
3
+ SHORTCUT: menu
4
+
5
+ DESCRIPTION
6
+ A CLI menu.
7
+ This can be used for the main loop of a CLI application.
8
+
9
+ CHILDREN
10
+ prompt - string - '> '
11
+ The shortcut may be used to select the menu item.
12
+ items - container
13
+ A textual description of the menu item action.
14
+ loop - boolean
15
+ The script that will be run if the menu item is selected.
16
+ default - script
17
+ Optional script element. Run this if no other option selected.
18
+
19
+ MESSAGES
20
+ run - Show the options and the the prompt.
21
+ Then run the script for the user's selection.
22
+ Optionally repeat as long as the loop child is true.
23
+
24
+ EXAMPLE
25
+
26
+ menu [menu] :
27
+ on_load [script] :
28
+ run menu
29
+ prompt [string] : >
30
+ loop [bool] : true
31
+ items [can] :
32
+ hw [mitem] :
33
+ shortcut [str] : hw
34
+ description [str] : Run Hello World
35
+ do [script] :
36
+ show 'Hello World!'
37
+ q [mitem] :
38
+ shortcut [str] : q
39
+ description [str] : Quit this menu
40
+ do [script] :
41
+ put false into menu.loop
42
+
43
+ SEE ALSO
44
+ menu_item
@@ -0,0 +1,26 @@
1
+ MENU_ITEM OBJECT TYPE
2
+ NAME: menu_item
3
+ SHORTCUT: mitem
4
+
5
+ DESCRIPTION
6
+ A CLI menu item. One element in a CLI menu.
7
+
8
+ CHILDREN
9
+ shortcut - string
10
+ The shortcut may be used to select the menu item.
11
+ The shortcut child is optional. If it is not provided,
12
+ the name of the menu item will be used instead.
13
+ description - string
14
+ A textual description of the menu item action.
15
+ The description child is optional. If it is not provided,
16
+ the value of the menu item will be used instead.
17
+ do - script
18
+ The script that will be run if the menu item is selected.
19
+
20
+ MESSAGES
21
+ None
22
+
23
+ EXAMPLE
24
+
25
+ SEE ALSO
26
+ menu
@@ -0,0 +1,43 @@
1
+ PASTEL OBJECT TYPE
2
+ NAME: pastel
3
+ SHORTCUT: pastel
4
+
5
+ DESCRIPTION
6
+ Show colorized text with the pastel gem.
7
+
8
+ CHILDREN
9
+ text - string
10
+ The text that will be colorized.
11
+ color - string
12
+ The colors. See pastel for options.
13
+
14
+ MESSAGES
15
+ show - Show the colorized text.
16
+
17
+ EXAMPLE
18
+
19
+ pastel [can] :
20
+ on_load [script] :
21
+ tell pastel.one to show
22
+ tell pastel.two to show
23
+ tell pastel.three to show
24
+ tell pastel.four to show
25
+ tell pastel.five to show
26
+ one [pastel] :
27
+ text [string] : Something New
28
+ color [string] : white on_green
29
+ two [pastel] :
30
+ text [string] : Star Wars
31
+ color [string] : red
32
+ three [pastel] :
33
+ text [string] : Many_Dimensions
34
+ color [string] : blue
35
+ four [pastel] :
36
+ text [string] : As An Arrow
37
+ color [string] : yellow on_blue
38
+ five [pastel] :
39
+ text [string] : Cranium
40
+ color [string] : white on_yellow
41
+
42
+ SEE ALSO
43
+ colorize
@@ -0,0 +1,27 @@
1
+ PROMPT OBJECT TYPE
2
+ NAME: prompt
3
+ SHORTCUT: ask
4
+
5
+ DESCRIPTION
6
+ CLI prompt for user input.
7
+
8
+ CHILDREN
9
+ prompt - string - '> '
10
+ The prompt displayed to the user.
11
+ result - string - none
12
+ The result with the user's input.
13
+
14
+ MESSAGES
15
+ run - Prompt the user and then set the result.
16
+ multiline - Show a multiline prompt.
17
+
18
+ EXAMPLE
19
+
20
+ ask [ask] :
21
+ prompt [string] : What is your name?
22
+ result [string] :
23
+ on_load [script] :
24
+ run ask
25
+ show 'Hello, ' + ask.result + '! Thanks for playing'
26
+
27
+ SEE ALSO
@@ -0,0 +1,34 @@
1
+ SELECT OBJECT TYPE
2
+ NAME: select
3
+ SHORTCUT: sel
4
+
5
+ DESCRIPTION
6
+ Prompt for user to select from a list of options.
7
+
8
+ CHILDREN
9
+ prompt - string - '> '
10
+ The prompt displayed to the user.
11
+ options - container
12
+ The list of options for the selection list.
13
+ The name of each option will be presented to the user, but
14
+ the value will be put in the result.
15
+ result - string - none
16
+ The result with the user's selection.
17
+
18
+ MESSAGES
19
+ run - Prompt the user for a selection and then set the result.
20
+
21
+ EXAMPLE
22
+
23
+ select [select] :
24
+ prompt [string] : What is your favorite color?
25
+ options [can] :
26
+ red : r
27
+ green : g
28
+ blue : b
29
+ result [string] :
30
+ on_load [script] :
31
+ run select
32
+ show select.result
33
+
34
+ SEE ALSO
@@ -0,0 +1,48 @@
1
+ EACH OBJECT TYPE
2
+ NAME: each
3
+ SHORTCUT: each
4
+
5
+ DESCRIPTION
6
+ Perform an action for each item in a collection.
7
+
8
+ CHILDREN
9
+ child | word | line | repo - string - none
10
+ The entity we want to loop for.
11
+ It will hold the current value while the script is running.
12
+ in - string - none
13
+ The collection we will iterate in.
14
+ In the case of <word> or <line> this will be a string or text.
15
+ In the case of <repo> this will be the root path.
16
+ do - script - none
17
+ The action we want to perform for each found item.
18
+
19
+ MESSAGES
20
+ run - Look through the collecion and perform this for each
21
+ found item.
22
+
23
+ EXAMPLE
24
+
25
+ #
26
+ # Show each child in a container.
27
+ #
28
+
29
+ for [each] :
30
+ child [alias] :
31
+ in [alias] : objs
32
+ do [script] : show for.child
33
+ objs [can] :
34
+ 1 [string] : one
35
+ 2 [string] : two
36
+ 3 [string] : three
37
+
38
+ #
39
+ # Show each word in a string.
40
+ #
41
+
42
+ for [each] :
43
+ word [string] :
44
+ in [string] : one word at a time
45
+ do [script] : show for.word
46
+
47
+
48
+ SEE ALSO
@@ -0,0 +1,38 @@
1
+ REPEAT OBJECT TYPE
2
+ NAME: repeat
3
+ SHORTCUT: repeat
4
+
5
+ DESCRIPTION
6
+ Run a script a given number of times.
7
+
8
+ CHILDREN
9
+ times integer - 0
10
+ The number of times to run the script.
11
+ index integer - 0
12
+ The current iteration when the repeat loop is running.
13
+ do - script - none
14
+ The action we want to perform for iteration of the loop.
15
+
16
+ MESSAGES
17
+ run - Run the script for the given number of times.
18
+
19
+ EXAMPLE
20
+
21
+ repeat [can] :
22
+ s [string] :
23
+ on_load [script] :
24
+ put $.screen_cols / 2 into repeat.x.times
25
+ tell repeat.x to run
26
+ show repeat.s
27
+ tell repeat.y to run
28
+ show repeat.s
29
+ x [repeat] :
30
+ times [integer] : 30
31
+ index [integer] : 0
32
+ do [script] : put repeat.s + '-' into repeat.s
33
+ y [repeat] :
34
+ times [integer] : 10
35
+ index [integer] : 0
36
+ do [script] : show repeat.y.index
37
+
38
+ SEE ALSO
@@ -0,0 +1,25 @@
1
+ MARKDOWN OBJECT TYPE
2
+ NAME: markdown
3
+ SHORTCUT: md
4
+
5
+ DESCRIPTION
6
+ Markdown data in a text string.
7
+
8
+ CHILDREN
9
+ None
10
+
11
+ MESSAGES
12
+ show - Show the markdown data in the terminal.
13
+ page - Show the markdown data in the terminal, paginated.
14
+
15
+ EXAMPLE
16
+
17
+ md [can] :
18
+ f [file] :
19
+ on_load [script] :
20
+ put $.gloo.projects + "/o/data/txt.md" into md.f
21
+ tell md.f to read (md.data)
22
+ tell md.data to show
23
+ data [md] :
24
+
25
+ SEE ALSO
@@ -0,0 +1,40 @@
1
+ SYSTEM OBJECT TYPE
2
+ NAME: mysql
3
+ SHORTCUT: mysql
4
+
5
+ DESCRIPTION
6
+ A MySQL database connection.
7
+
8
+ CHILDREN
9
+ host - string
10
+ The database server host
11
+ database - string
12
+ The name of the database.
13
+ username - string
14
+ The username with which to connect.
15
+ pasword - string
16
+ The user's password.
17
+
18
+ MESSAGES
19
+ verify - Verify that the database connection can be established.
20
+
21
+ EXAMPLE
22
+
23
+ mysql [can] :
24
+ on_load [script] :
25
+ run mysql.get_passwd
26
+ run mysql.sql
27
+ db [mysql] :
28
+ host : localhost
29
+ database : my_database
30
+ username : my_user
31
+ password [alias] : mysql.get_passwd.result
32
+ sql [query] :
33
+ database [alias] : mysql.db
34
+ sql : SELECT first, last, phone FROM people
35
+ get_passwd [ask] :
36
+ prompt [string] : Database Password?
37
+ result [string] :
38
+
39
+ SEE ALSO
40
+ query, sqlite
@@ -0,0 +1,37 @@
1
+ SYSTEM OBJECT TYPE
2
+ NAME: query
3
+ SHORTCUT: sql
4
+
5
+ DESCRIPTION
6
+ A SQL Query.
7
+ A SELECT, INSERT, UPDATE or other SQL statement.
8
+ The query requires a valid database connection.
9
+
10
+ CHILDREN
11
+ database - string
12
+ The name of the database.
13
+ sql - string
14
+ The SQL query to execute.
15
+ result - container
16
+ The result of the query will be a container for each row,
17
+ with an object for each column.
18
+ The result container is optional. If it is not present,
19
+ the results will be displayed in the console.
20
+ params - container
21
+ Optional list of parameters for the query.
22
+
23
+ MESSAGES
24
+ run - Run the query and get back the data.
25
+
26
+ EXAMPLE
27
+
28
+ sqlite [can] :
29
+ on_load [script] : run sqlite.sql
30
+ db [sqlite] :
31
+ database : test.db
32
+ sql [query] :
33
+ database [alias] : sqlite.db
34
+ sql : SELECT id, key, value FROM key_values
35
+
36
+ SEE ALSO
37
+ mysql, sqlite