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.
- checksums.yaml +4 -4
- data/lib/VERSION +1 -1
- data/lib/dependencies.rb +2 -2
- data/lib/{gloo_lang.rb → gloo-lang.rb} +7 -9
- data/lib/gloo_lang/app/args.rb +112 -0
- data/lib/gloo_lang/app/engine.rb +230 -0
- data/lib/gloo_lang/app/help.rb +156 -0
- data/lib/gloo_lang/app/log.rb +81 -0
- data/lib/gloo_lang/app/mode.rb +27 -0
- data/lib/gloo_lang/app/settings.rb +186 -0
- data/lib/gloo_lang/convert/converter.rb +35 -0
- data/lib/gloo_lang/convert/string_to_datetime.rb +21 -0
- data/lib/gloo_lang/convert/string_to_decimal.rb +20 -0
- data/lib/gloo_lang/convert/string_to_integer.rb +20 -0
- data/lib/gloo_lang/core/baseo.rb +30 -0
- data/lib/gloo_lang/core/dictionary.rb +181 -0
- data/lib/gloo_lang/core/error.rb +61 -0
- data/lib/gloo_lang/core/event_manager.rb +44 -0
- data/lib/gloo_lang/core/factory.rb +210 -0
- data/lib/gloo_lang/core/gloo_system.rb +266 -0
- data/lib/gloo_lang/core/heap.rb +52 -0
- data/lib/gloo_lang/core/here.rb +36 -0
- data/lib/gloo_lang/core/it.rb +36 -0
- data/lib/gloo_lang/core/literal.rb +30 -0
- data/lib/gloo_lang/core/obj.rb +303 -0
- data/lib/gloo_lang/core/obj_finder.rb +30 -0
- data/lib/gloo_lang/core/op.rb +40 -0
- data/lib/gloo_lang/core/parser.rb +59 -0
- data/lib/gloo_lang/core/pn.rb +188 -0
- data/lib/gloo_lang/core/tokens.rb +165 -0
- data/lib/gloo_lang/core/verb.rb +86 -0
- data/lib/gloo_lang/exec/action.rb +48 -0
- data/lib/gloo_lang/exec/dispatch.rb +40 -0
- data/lib/gloo_lang/exec/exec_env.rb +74 -0
- data/lib/gloo_lang/exec/runner.rb +45 -0
- data/lib/gloo_lang/exec/script.rb +49 -0
- data/lib/gloo_lang/exec/stack.rb +78 -0
- data/lib/gloo_lang/expr/expression.rb +118 -0
- data/lib/gloo_lang/expr/l_boolean.rb +36 -0
- data/lib/gloo_lang/expr/l_decimal.rb +39 -0
- data/lib/gloo_lang/expr/l_integer.rb +37 -0
- data/lib/gloo_lang/expr/l_string.rb +58 -0
- data/lib/gloo_lang/expr/op_div.rb +22 -0
- data/lib/gloo_lang/expr/op_minus.rb +22 -0
- data/lib/gloo_lang/expr/op_mult.rb +22 -0
- data/lib/gloo_lang/expr/op_plus.rb +24 -0
- data/lib/gloo_lang/help/app/application.txt +22 -0
- data/lib/gloo_lang/help/app/configuration.txt +7 -0
- data/lib/gloo_lang/help/app/default_help.txt +14 -0
- data/lib/gloo_lang/help/app/logging.txt +16 -0
- data/lib/gloo_lang/help/core/color.txt +31 -0
- data/lib/gloo_lang/help/core/error.txt +33 -0
- data/lib/gloo_lang/help/core/events.txt +21 -0
- data/lib/gloo_lang/help/core/gloo_system.txt +57 -0
- data/lib/gloo_lang/help/core/here.txt +30 -0
- data/lib/gloo_lang/help/core/it.txt +23 -0
- data/lib/gloo_lang/help/core/ops.txt +16 -0
- data/lib/gloo_lang/help/core/pathname.txt +29 -0
- data/lib/gloo_lang/help/objs/basic/alias.txt +36 -0
- data/lib/gloo_lang/help/objs/basic/boolean.txt +28 -0
- data/lib/gloo_lang/help/objs/basic/container.txt +33 -0
- data/lib/gloo_lang/help/objs/basic/decimal.txt +28 -0
- data/lib/gloo_lang/help/objs/basic/integer.txt +27 -0
- data/lib/gloo_lang/help/objs/basic/script.txt +29 -0
- data/lib/gloo_lang/help/objs/basic/string.txt +28 -0
- data/lib/gloo_lang/help/objs/basic/text.txt +27 -0
- data/lib/gloo_lang/help/objs/basic/untyped.txt +22 -0
- data/lib/gloo_lang/help/objs/cli/banner.txt +49 -0
- data/lib/gloo_lang/help/objs/cli/bar.txt +37 -0
- data/lib/gloo_lang/help/objs/cli/colorize.txt +33 -0
- data/lib/gloo_lang/help/objs/cli/confirm.txt +26 -0
- data/lib/gloo_lang/help/objs/cli/menu.txt +44 -0
- data/lib/gloo_lang/help/objs/cli/menu_item.txt +26 -0
- data/lib/gloo_lang/help/objs/cli/pastel.txt +43 -0
- data/lib/gloo_lang/help/objs/cli/prompt.txt +27 -0
- data/lib/gloo_lang/help/objs/cli/select.txt +34 -0
- data/lib/gloo_lang/help/objs/ctrl/each.txt +48 -0
- data/lib/gloo_lang/help/objs/ctrl/repeat.txt +38 -0
- data/lib/gloo_lang/help/objs/data/markdown.txt +25 -0
- data/lib/gloo_lang/help/objs/data/mysql.txt +40 -0
- data/lib/gloo_lang/help/objs/data/query.txt +37 -0
- data/lib/gloo_lang/help/objs/data/sqlite.txt +26 -0
- data/lib/gloo_lang/help/objs/data/table.txt +46 -0
- data/lib/gloo_lang/help/objs/dev/git_repo.txt +36 -0
- data/lib/gloo_lang/help/objs/dev/stats.txt +36 -0
- data/lib/gloo_lang/help/objs/dt/date.txt +23 -0
- data/lib/gloo_lang/help/objs/dt/datetime.txt +24 -0
- data/lib/gloo_lang/help/objs/dt/time.txt +23 -0
- data/lib/gloo_lang/help/objs/ror/erb.txt +37 -0
- data/lib/gloo_lang/help/objs/ror/eval.txt +24 -0
- data/lib/gloo_lang/help/objs/snd/play.txt +23 -0
- data/lib/gloo_lang/help/objs/snd/say.txt +28 -0
- data/lib/gloo_lang/help/objs/system/file.txt +48 -0
- data/lib/gloo_lang/help/objs/system/ssh_exec.txt +30 -0
- data/lib/gloo_lang/help/objs/system/system.txt +32 -0
- data/lib/gloo_lang/help/objs/web/http_get.txt +35 -0
- data/lib/gloo_lang/help/objs/web/http_post.txt +34 -0
- data/lib/gloo_lang/help/objs/web/json.txt +34 -0
- data/lib/gloo_lang/help/objs/web/slack.txt +33 -0
- data/lib/gloo_lang/help/objs/web/teams.txt +30 -0
- data/lib/gloo_lang/help/objs/web/uri.txt +38 -0
- data/lib/gloo_lang/help/verbs/alert.txt +33 -0
- data/lib/gloo_lang/help/verbs/beep.txt +25 -0
- data/lib/gloo_lang/help/verbs/cls.txt +24 -0
- data/lib/gloo_lang/help/verbs/context.txt +43 -0
- data/lib/gloo_lang/help/verbs/create.txt +33 -0
- data/lib/gloo_lang/help/verbs/execute.txt +27 -0
- data/lib/gloo_lang/help/verbs/help.txt +34 -0
- data/lib/gloo_lang/help/verbs/if.txt +37 -0
- data/lib/gloo_lang/help/verbs/list.txt +34 -0
- data/lib/gloo_lang/help/verbs/load.txt +38 -0
- data/lib/gloo_lang/help/verbs/move.txt +42 -0
- data/lib/gloo_lang/help/verbs/put.txt +38 -0
- data/lib/gloo_lang/help/verbs/quit.txt +25 -0
- data/lib/gloo_lang/help/verbs/run.txt +41 -0
- data/lib/gloo_lang/help/verbs/save.txt +26 -0
- data/lib/gloo_lang/help/verbs/show.txt +30 -0
- data/lib/gloo_lang/help/verbs/tell.txt +34 -0
- data/lib/gloo_lang/help/verbs/unless.txt +38 -0
- data/lib/gloo_lang/help/verbs/version.txt +32 -0
- data/lib/gloo_lang/help/verbs/wait.txt +29 -0
- data/lib/gloo_lang/objs/basic/alias.rb +78 -0
- data/lib/gloo_lang/objs/basic/boolean.rb +120 -0
- data/lib/gloo_lang/objs/basic/container.rb +76 -0
- data/lib/gloo_lang/objs/basic/decimal.rb +76 -0
- data/lib/gloo_lang/objs/basic/integer.rb +73 -0
- data/lib/gloo_lang/objs/basic/script.rb +99 -0
- data/lib/gloo_lang/objs/basic/string.rb +77 -0
- data/lib/gloo_lang/objs/basic/text.rb +87 -0
- data/lib/gloo_lang/objs/basic/untyped.rb +41 -0
- data/lib/gloo_lang/objs/cli/banner.rb +108 -0
- data/lib/gloo_lang/objs/cli/bar.rb +133 -0
- data/lib/gloo_lang/objs/cli/colorize.rb +73 -0
- data/lib/gloo_lang/objs/cli/confirm.rb +96 -0
- data/lib/gloo_lang/objs/cli/menu.rb +206 -0
- data/lib/gloo_lang/objs/cli/menu_item.rb +95 -0
- data/lib/gloo_lang/objs/cli/pastel.rb +97 -0
- data/lib/gloo_lang/objs/cli/prompt.rb +110 -0
- data/lib/gloo_lang/objs/cli/select.rb +126 -0
- data/lib/gloo_lang/objs/ctrl/each.rb +279 -0
- data/lib/gloo_lang/objs/ctrl/repeat.rb +108 -0
- data/lib/gloo_lang/objs/data/markdown.rb +84 -0
- data/lib/gloo_lang/objs/data/mysql.rb +192 -0
- data/lib/gloo_lang/objs/data/query.rb +176 -0
- data/lib/gloo_lang/objs/data/sqlite.rb +159 -0
- data/lib/gloo_lang/objs/data/table.rb +140 -0
- data/lib/gloo_lang/objs/dev/git.rb +140 -0
- data/lib/gloo_lang/objs/dev/stats.rb +120 -0
- data/lib/gloo_lang/objs/dt/date.rb +50 -0
- data/lib/gloo_lang/objs/dt/datetime.rb +62 -0
- data/lib/gloo_lang/objs/dt/time.rb +50 -0
- data/lib/gloo_lang/objs/ror/erb.rb +116 -0
- data/lib/gloo_lang/objs/ror/eval.rb +107 -0
- data/lib/gloo_lang/objs/snd/play.rb +48 -0
- data/lib/gloo_lang/objs/snd/say.rb +98 -0
- data/lib/gloo_lang/objs/system/file_handle.rb +138 -0
- data/lib/gloo_lang/objs/system/ssh_exec.rb +126 -0
- data/lib/gloo_lang/objs/system/system.rb +136 -0
- data/lib/gloo_lang/objs/web/http_get.rb +159 -0
- data/lib/gloo_lang/objs/web/http_post.rb +183 -0
- data/lib/gloo_lang/objs/web/json.rb +135 -0
- data/lib/gloo_lang/objs/web/slack.rb +130 -0
- data/lib/gloo_lang/objs/web/teams.rb +117 -0
- data/lib/gloo_lang/objs/web/uri.rb +148 -0
- data/lib/gloo_lang/persist/file_loader.rb +191 -0
- data/lib/gloo_lang/persist/file_saver.rb +49 -0
- data/lib/gloo_lang/persist/file_storage.rb +45 -0
- data/lib/gloo_lang/persist/line_splitter.rb +81 -0
- data/lib/gloo_lang/persist/persist_man.rb +120 -0
- data/lib/gloo_lang/utils/format.rb +21 -0
- data/lib/gloo_lang/utils/stats.rb +205 -0
- data/lib/gloo_lang/utils/words.rb +19 -0
- data/lib/gloo_lang/verbs/alert.rb +79 -0
- data/lib/gloo_lang/verbs/beep.rb +40 -0
- data/lib/gloo_lang/verbs/cls.rb +37 -0
- data/lib/gloo_lang/verbs/context.rb +62 -0
- data/lib/gloo_lang/verbs/create.rb +68 -0
- data/lib/gloo_lang/verbs/execute.rb +56 -0
- data/lib/gloo_lang/verbs/help.rb +264 -0
- data/lib/gloo_lang/verbs/if.rb +92 -0
- data/lib/gloo_lang/verbs/list.rb +98 -0
- data/lib/gloo_lang/verbs/load.rb +45 -0
- data/lib/gloo_lang/verbs/move.rb +89 -0
- data/lib/gloo_lang/verbs/put.rb +94 -0
- data/lib/gloo_lang/verbs/quit.rb +40 -0
- data/lib/gloo_lang/verbs/run.rb +75 -0
- data/lib/gloo_lang/verbs/save.rb +39 -0
- data/lib/gloo_lang/verbs/show.rb +64 -0
- data/lib/gloo_lang/verbs/tell.rb +79 -0
- data/lib/gloo_lang/verbs/unless.rb +92 -0
- data/lib/gloo_lang/verbs/version.rb +37 -0
- data/lib/gloo_lang/verbs/wait.rb +42 -0
- metadata +191 -3
@@ -0,0 +1,36 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# An Expression that can be evaluated.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class LBoolean < GlooLang::Core::Literal
|
10
|
+
|
11
|
+
#
|
12
|
+
# Is the given token a boolean?
|
13
|
+
#
|
14
|
+
def self.boolean?( token )
|
15
|
+
return GlooLang::Objs::Boolean.boolean? token
|
16
|
+
end
|
17
|
+
|
18
|
+
#
|
19
|
+
# Set the value, converting to an boolean.
|
20
|
+
#
|
21
|
+
def set_value( value )
|
22
|
+
@value = GlooLang::Objs::Boolean.coerse_to_bool value
|
23
|
+
end
|
24
|
+
|
25
|
+
#
|
26
|
+
# Get string representation
|
27
|
+
#
|
28
|
+
def to_s
|
29
|
+
return 'false' unless @value
|
30
|
+
|
31
|
+
return @value.to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# A literal decimal value.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class LDecimal < GlooLang::Core::Literal
|
10
|
+
|
11
|
+
#
|
12
|
+
# Is the given token a decimal?
|
13
|
+
#
|
14
|
+
def self.decimal?( token )
|
15
|
+
return true if token.is_a? Numeric
|
16
|
+
|
17
|
+
s = token.strip
|
18
|
+
return s.to_f.to_s == s
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Set the value, converting to an integer.
|
23
|
+
#
|
24
|
+
def set_value( value )
|
25
|
+
value = value.to_s if value.is_a? Numeric
|
26
|
+
|
27
|
+
@value = value.to_f
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Get string representation
|
32
|
+
#
|
33
|
+
def to_s
|
34
|
+
return self.value.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# An Expression that can be evaluated.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class LInteger < GlooLang::Core::Literal
|
10
|
+
|
11
|
+
#
|
12
|
+
# Is the given token an integer?
|
13
|
+
#
|
14
|
+
def self.integer?( token )
|
15
|
+
return true if token.is_a? Integer
|
16
|
+
|
17
|
+
s = token.strip
|
18
|
+
return s.to_i.to_s == s
|
19
|
+
end
|
20
|
+
|
21
|
+
#
|
22
|
+
# Set the value, converting to an integer.
|
23
|
+
#
|
24
|
+
def set_value( value )
|
25
|
+
@value = value.to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Get string representation
|
30
|
+
#
|
31
|
+
def to_s
|
32
|
+
return self.value.to_s
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# An Expression that can be evaluated.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class LString < GlooLang::Core::Literal
|
10
|
+
|
11
|
+
#
|
12
|
+
# Set the value, triming opening and closing
|
13
|
+
# quotations if necessary.
|
14
|
+
#
|
15
|
+
def set_value( value )
|
16
|
+
@value = value
|
17
|
+
return unless value
|
18
|
+
|
19
|
+
@value = LString.strip_quotes( @value )
|
20
|
+
end
|
21
|
+
|
22
|
+
#
|
23
|
+
# Is the given token a string?
|
24
|
+
#
|
25
|
+
def self.string?( token )
|
26
|
+
return false unless token.is_a? String
|
27
|
+
return true if token.start_with?( '"' )
|
28
|
+
return true if token.start_with?( "'" )
|
29
|
+
|
30
|
+
return false
|
31
|
+
end
|
32
|
+
|
33
|
+
#
|
34
|
+
# Given a string with leading and trailing quotes,
|
35
|
+
# strip them out.
|
36
|
+
#
|
37
|
+
def self.strip_quotes( str )
|
38
|
+
if str.start_with?( '"' )
|
39
|
+
str = str[ 1..-1 ]
|
40
|
+
str = str[ 0..-2 ] if str.end_with?( '"' )
|
41
|
+
return str
|
42
|
+
elsif str.start_with?( "'" )
|
43
|
+
str = str[ 1..-1 ]
|
44
|
+
str = str[ 0..-2 ] if str.end_with?( "'" )
|
45
|
+
return str
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
#
|
50
|
+
# Get string representation
|
51
|
+
#
|
52
|
+
def to_s
|
53
|
+
return self.value
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Division operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class OpDiv < GlooLang::Core::Op
|
10
|
+
|
11
|
+
#
|
12
|
+
# Perform the operation and return the result.
|
13
|
+
#
|
14
|
+
def perform( left, right )
|
15
|
+
return left / right.to_i if left.is_a? Integer
|
16
|
+
|
17
|
+
return left / right.to_f if left.is_a? Numeric
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Subtraction operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class OpMinus < GlooLang::Core::Op
|
10
|
+
|
11
|
+
#
|
12
|
+
# Perform the operation and return the result.
|
13
|
+
#
|
14
|
+
def perform( left, right )
|
15
|
+
return left - right.to_i if left.is_a? Integer
|
16
|
+
|
17
|
+
return left - right.to_f if left.is_a? Numeric
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Multiplication operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class OpMult < GlooLang::Core::Op
|
10
|
+
|
11
|
+
#
|
12
|
+
# Perform the operation and return the result.
|
13
|
+
#
|
14
|
+
def perform( left, right )
|
15
|
+
return left * right.to_i if left.is_a? Integer
|
16
|
+
|
17
|
+
return left * right.to_f if left.is_a? Numeric
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Addition operator.
|
5
|
+
#
|
6
|
+
|
7
|
+
module GlooLang
|
8
|
+
module Expr
|
9
|
+
class OpPlus < GlooLang::Core::Op
|
10
|
+
|
11
|
+
#
|
12
|
+
# Perform the operation and return the result.
|
13
|
+
#
|
14
|
+
def perform( left, right )
|
15
|
+
return left + right.to_s if left.is_a? String
|
16
|
+
|
17
|
+
return left + right.to_i if left.is_a? Integer
|
18
|
+
|
19
|
+
return left + right.to_f if left.is_a? Numeric
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
GLOO APPLICATION
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
Gloo scripting language. A scripting language built on ruby.
|
5
|
+
More information coming soon.
|
6
|
+
|
7
|
+
SYNOPSIS
|
8
|
+
gloo [global option] [file]
|
9
|
+
|
10
|
+
GLOBAL OPTIONS
|
11
|
+
--cli - Run in CLI mode
|
12
|
+
- If no options are specified, this is the default.
|
13
|
+
--version - Show application version
|
14
|
+
--help - Show this help page
|
15
|
+
|
16
|
+
FILE
|
17
|
+
TODO: document running a gloo script
|
18
|
+
how to reference files by relative path in gloo folder
|
19
|
+
and also by absolute path
|
20
|
+
|
21
|
+
SEE ALSO
|
22
|
+
application, configuration
|
@@ -0,0 +1,14 @@
|
|
1
|
+
GLOO HELP
|
2
|
+
|
3
|
+
TODO: write this article
|
4
|
+
|
5
|
+
LISTS
|
6
|
+
Show options for object and verb lists
|
7
|
+
|
8
|
+
DETAIL
|
9
|
+
How to get help detail for verbs and objects
|
10
|
+
How to see a help pages
|
11
|
+
How to see a list of help pages (topics)
|
12
|
+
|
13
|
+
SEE ALSO
|
14
|
+
application, configuration
|
@@ -0,0 +1,16 @@
|
|
1
|
+
GLOO APPLICATION LOGGING
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
Gloo writes to the gloo.log as well as to the console.
|
5
|
+
Debug messages are written to the log only, but other messages
|
6
|
+
are also written to the console unless the application is
|
7
|
+
running in quiet mode.
|
8
|
+
|
9
|
+
CONFIGURATION
|
10
|
+
The application logs folder is in the gloo folder.
|
11
|
+
When gloo is run, the gloo.log file will be written to.
|
12
|
+
|
13
|
+
TAIL
|
14
|
+
Example tail command to watch the gloo log:
|
15
|
+
|
16
|
+
tail -f ~/gloo/logs/gloo.log
|
@@ -0,0 +1,31 @@
|
|
1
|
+
COLOR
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
The following colors can be used by the show verb to display
|
5
|
+
colored text:
|
6
|
+
|
7
|
+
red
|
8
|
+
blue
|
9
|
+
green
|
10
|
+
white
|
11
|
+
black
|
12
|
+
yellow
|
13
|
+
|
14
|
+
The color names are considered as virtual objects but may
|
15
|
+
also be referenced in variables. See the example below.
|
16
|
+
|
17
|
+
EXAMPLE
|
18
|
+
Here are some examples of expression usage:
|
19
|
+
|
20
|
+
#
|
21
|
+
# Show multiple messages in color
|
22
|
+
#
|
23
|
+
colors [can] :
|
24
|
+
var [string] : red
|
25
|
+
on_load [script] :
|
26
|
+
show "red" (colors.var)
|
27
|
+
show "blue" (blue)
|
28
|
+
show "green" (green)
|
29
|
+
|
30
|
+
SEE ALSO
|
31
|
+
show
|
@@ -0,0 +1,33 @@
|
|
1
|
+
ERROR
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
Gloo has a special 'error' variable that's not part of the normal
|
5
|
+
object heap. The error will be empty most of the time, but
|
6
|
+
if a command results in an error, this variable will hold the
|
7
|
+
error message until the next command is executed. The error
|
8
|
+
is a string and can be accessed by simply referring to the
|
9
|
+
path-name 'error'.
|
10
|
+
|
11
|
+
EXAMPLE
|
12
|
+
To see the last error:
|
13
|
+
|
14
|
+
> show error
|
15
|
+
|
16
|
+
To run a command that generates an error:
|
17
|
+
|
18
|
+
> put 3 into
|
19
|
+
'put' must include 'into' target
|
20
|
+
|
21
|
+
Then, showing the error
|
22
|
+
|
23
|
+
> show error
|
24
|
+
'put' must include 'into' target
|
25
|
+
|
26
|
+
But, as mentioned, the next command will clear out the last error.
|
27
|
+
If you need to keep track of the result of a command, you should
|
28
|
+
put the error into another object.
|
29
|
+
|
30
|
+
> create err as string
|
31
|
+
> put 3 into
|
32
|
+
> put error into err
|
33
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
EVENTS
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
Scripts can be written to be triggered by events. The current list is as
|
5
|
+
follows, but it is expected that the list of events will grow.
|
6
|
+
|
7
|
+
on_load - run when a script loads
|
8
|
+
on_unload - run when an object receives an unload message
|
9
|
+
|
10
|
+
TODO: add event types.
|
11
|
+
|
12
|
+
EXAMPLE
|
13
|
+
Show a message when a file is loaded:
|
14
|
+
|
15
|
+
start [container] :
|
16
|
+
on_load [script] : show "Welcome back!" (white)
|
17
|
+
|
18
|
+
Show a message when a file unloaded:
|
19
|
+
|
20
|
+
done [container] :
|
21
|
+
on_unload [script] : show "See ya soon!" (white)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
GLOO SYSTEM OBJECTS
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
The gloo system objects are virtual objects. That is that they
|
5
|
+
can be accessed like other objects. But the values are set by
|
6
|
+
the system. The values cannot be updated. The other difference
|
7
|
+
is that the virtual objects do not show up in the object heap.
|
8
|
+
|
9
|
+
ACCESS
|
10
|
+
The gloo objects can be accessed through the 'gloo' root level
|
11
|
+
virtual object designation. There is also a shortcut for the virtual
|
12
|
+
object path: '$'. For example, to see the current user:
|
13
|
+
|
14
|
+
> show gloo.user
|
15
|
+
|
16
|
+
Or:
|
17
|
+
|
18
|
+
> show $.user
|
19
|
+
|
20
|
+
Some objects include an '_' to separate words. As an alternative,
|
21
|
+
a '.' can be used instead. The following commands are treated as
|
22
|
+
identical:
|
23
|
+
|
24
|
+
> show gloo.working_dir
|
25
|
+
> show gloo.working.dir
|
26
|
+
> show $.working_dir
|
27
|
+
> show $.working.dir
|
28
|
+
|
29
|
+
OBJECTS
|
30
|
+
|
31
|
+
IDENTITY
|
32
|
+
gloo.hostname # Get the system hostname.
|
33
|
+
gloo.user # Get the logged in User.
|
34
|
+
|
35
|
+
SPECIAL CHARS
|
36
|
+
gloo.line # A carriage return (line feed) character.
|
37
|
+
|
38
|
+
FILE SYSTEM
|
39
|
+
gloo.user_home # Get the user's home directory.
|
40
|
+
gloo.working_dir # Get the working directory.
|
41
|
+
gloo.gloo_home # Get the gloo home directory
|
42
|
+
gloo.gloo_config # Get the gloo configuration directory
|
43
|
+
gloo.gloo_projects # Get the gloo projects directory
|
44
|
+
gloo.gloo_log # Get the gloo logging directory
|
45
|
+
|
46
|
+
SCREEN
|
47
|
+
gloo.screen_lines # Get the number of lines on screen.
|
48
|
+
gloo.screen_cols # Get the number of columns on screen.
|
49
|
+
|
50
|
+
PLATFORM
|
51
|
+
gloo.platform_cpu # Get the platform CPU
|
52
|
+
gloo.platform_os # Get the platform Operating System
|
53
|
+
gloo.platform_version # Get the platform version
|
54
|
+
gloo.platform_windows? # Is the platform Windows?
|
55
|
+
gloo.platform_unix? # Is the platform Unix?
|
56
|
+
gloo.platform_linux? # Is the platform Linux?
|
57
|
+
gloo.platform_mac? # Is the platform Mac?
|
@@ -0,0 +1,30 @@
|
|
1
|
+
HERE
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
Gloo scripts can use relative referencing to access objects
|
5
|
+
without specifying the full path. This relative referencing is
|
6
|
+
referred to with the 'here' operator: ^
|
7
|
+
|
8
|
+
EXAMPLE
|
9
|
+
In the following script, the here reference is used several times:
|
10
|
+
|
11
|
+
#
|
12
|
+
# Use here reference.
|
13
|
+
#
|
14
|
+
here [can] :
|
15
|
+
s [str] : local string
|
16
|
+
on_load [script] : show ^.s
|
17
|
+
a [can] :
|
18
|
+
s [str] : A string
|
19
|
+
b [can] :
|
20
|
+
s [str] : B string
|
21
|
+
on_load [script] :
|
22
|
+
show ^.s
|
23
|
+
show ^^.s
|
24
|
+
|
25
|
+
A single use of '^' means: refer to an object at the same level
|
26
|
+
as the running script. It tells the interpreter to 'look here'
|
27
|
+
for the object.
|
28
|
+
|
29
|
+
Use of two ^^ here references means to go up a level, and
|
30
|
+
so forth.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
IT
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
'It' is a special virtual object. 'It' contains the value of
|
5
|
+
the last expression or command run. Not all commands result in
|
6
|
+
a change to the value of it.
|
7
|
+
|
8
|
+
EXAMPLE
|
9
|
+
Get the value of an expression and store it somewhere for later use:
|
10
|
+
|
11
|
+
#
|
12
|
+
# Example of usage of 'it'.
|
13
|
+
#
|
14
|
+
it_example [can] :
|
15
|
+
result [int] :
|
16
|
+
on_load [script] :
|
17
|
+
show 3 + 4
|
18
|
+
put it into ^.result
|
19
|
+
show ^.result
|
20
|
+
|
21
|
+
Running this script will show 7 twice. The first time will be the
|
22
|
+
result of the addition. The second time will be showing the
|
23
|
+
result object.
|
@@ -0,0 +1,29 @@
|
|
1
|
+
PATHNAME
|
2
|
+
|
3
|
+
DESCRIPTION
|
4
|
+
All gloo object data and scripts are stored in a heap of objects or
|
5
|
+
just "the heap". The heap is hierarchical, with some objects having
|
6
|
+
children objects. To reference an object, we use a "pathname". The
|
7
|
+
pathname starts with the root level object then has a period, ".",
|
8
|
+
then the child object name, and so forth. "a.b.c" refers to the "c"
|
9
|
+
object in the "b" container, which is in the "a" container.
|
10
|
+
|
11
|
+
ROOT
|
12
|
+
The word "root" is not needed when referring to objects. In some
|
13
|
+
special cases, "root" can be used to point to the first level of
|
14
|
+
the object heap. One such use would be with the "context" verb.
|
15
|
+
|
16
|
+
EXAMPLE
|
17
|
+
Here is an example of objects and a pathname reference to an
|
18
|
+
object within the hierarchy:
|
19
|
+
|
20
|
+
#
|
21
|
+
# Hierarchical containers.
|
22
|
+
#
|
23
|
+
a [can] :
|
24
|
+
b [can] :
|
25
|
+
c [string] : Hello World
|
26
|
+
on_load [script] : show a.b.c
|
27
|
+
|
28
|
+
SEE ALSO
|
29
|
+
context
|
@@ -0,0 +1,36 @@
|
|
1
|
+
ALIAS OBJECT TYPE
|
2
|
+
NAME: alias
|
3
|
+
SHORTCUT: ln
|
4
|
+
|
5
|
+
DESCRIPTION
|
6
|
+
A pointer to another object.
|
7
|
+
Normal path-name references will refere to the aliased object.
|
8
|
+
To refer to the alias itself, add an * at the end of the path-name.
|
9
|
+
This is neeed, for example, to set the value of the alias.
|
10
|
+
The value of the alias is merely the path-name of the
|
11
|
+
referenced object.
|
12
|
+
|
13
|
+
CHILDREN
|
14
|
+
None
|
15
|
+
|
16
|
+
MESSAGES
|
17
|
+
The alias will reflect the mesages of the object to which
|
18
|
+
it points.
|
19
|
+
The alias itself can receive the following message:
|
20
|
+
resolve - Check to see if the object referenced exists.
|
21
|
+
Sets it to true or false.
|
22
|
+
|
23
|
+
EXAMPLE
|
24
|
+
|
25
|
+
a [can] :
|
26
|
+
s [string] : a string
|
27
|
+
i [integer] : 13
|
28
|
+
ln [alias] : a.s
|
29
|
+
on_load [script] :
|
30
|
+
show a.ln
|
31
|
+
show a.ln*
|
32
|
+
put 'a.i' into a.ln*
|
33
|
+
put 7 into a.ln
|
34
|
+
show a.ln
|
35
|
+
|
36
|
+
SEE ALSO
|
@@ -0,0 +1,28 @@
|
|
1
|
+
BOOLEAN OBJECT TYPE
|
2
|
+
NAME: boolean
|
3
|
+
SHORTCUT: bool
|
4
|
+
|
5
|
+
DESCRIPTION
|
6
|
+
A boolean value.
|
7
|
+
Value will be either true or false.
|
8
|
+
|
9
|
+
CHILDREN
|
10
|
+
None
|
11
|
+
|
12
|
+
MESSAGES
|
13
|
+
not - Set the boolean to the opposite of what it is now.
|
14
|
+
true - Set the boolean to true.
|
15
|
+
false - Set the boolean to false.
|
16
|
+
|
17
|
+
EXAMPLE
|
18
|
+
|
19
|
+
b [can] :
|
20
|
+
flag [boolean] : true
|
21
|
+
on_load [script] :
|
22
|
+
show b.flag
|
23
|
+
put false into b.flag
|
24
|
+
show b.flag
|
25
|
+
tell b.flag to not
|
26
|
+
show b.flag
|
27
|
+
|
28
|
+
SEE ALSO
|
@@ -0,0 +1,33 @@
|
|
1
|
+
CONTAINER OBJECT TYPE
|
2
|
+
NAME: container
|
3
|
+
SHORTCUT: can
|
4
|
+
|
5
|
+
DESCRIPTION
|
6
|
+
A container of other objects.
|
7
|
+
A container is similar to a folder in a file system.
|
8
|
+
It can contain any number of objects including other containers.
|
9
|
+
The container structure provides direct access to any object
|
10
|
+
within it through the object.object.object path-name structure.
|
11
|
+
|
12
|
+
CHILDREN
|
13
|
+
None by default. But any container can have any number of
|
14
|
+
objects added to it.
|
15
|
+
|
16
|
+
MESSAGES
|
17
|
+
count - Count the number of children objects in the container.
|
18
|
+
The result is put in <it>.
|
19
|
+
delete_children - Delete all children objects from the container.
|
20
|
+
show_key_value_tbl - Show a table with key (name) and values
|
21
|
+
for all children in the container.
|
22
|
+
|
23
|
+
EXAMPLE
|
24
|
+
|
25
|
+
can [can] :
|
26
|
+
data [can] :
|
27
|
+
1 : one
|
28
|
+
2 : two
|
29
|
+
3 : three
|
30
|
+
on_load [script] :
|
31
|
+
tell can.data to show_key_value_table
|
32
|
+
|
33
|
+
SEE ALSO
|