gloo-lang 0.9.4 → 0.9.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/gloo-lang.gemspec +1 -0
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/args.rb +0 -1
- data/lib/gloo_lang/app/engine.rb +10 -37
- data/lib/gloo_lang/app/help.rb +2 -41
- data/lib/gloo_lang/app/log.rb +8 -10
- data/lib/gloo_lang/app/platform.rb +75 -0
- data/lib/gloo_lang/app/settings.rb +36 -13
- data/lib/gloo_lang/objs/basic/container.rb +1 -12
- data/lib/gloo_lang/objs/basic/text.rb +2 -10
- data/lib/gloo_lang/objs/data/markdown.rb +2 -7
- data/lib/gloo_lang/objs/data/table.rb +1 -29
- data/lib/gloo_lang/verbs/show.rb +3 -2
- metadata +22 -22
- data/lib/gloo_lang/objs/cli/banner.rb +0 -108
- data/lib/gloo_lang/objs/cli/bar.rb +0 -133
- data/lib/gloo_lang/objs/cli/colorize.rb +0 -73
- data/lib/gloo_lang/objs/cli/confirm.rb +0 -96
- data/lib/gloo_lang/objs/cli/menu.rb +0 -206
- data/lib/gloo_lang/objs/cli/menu_item.rb +0 -95
- data/lib/gloo_lang/objs/cli/pastel.rb +0 -97
- data/lib/gloo_lang/objs/cli/prompt.rb +0 -110
- data/lib/gloo_lang/objs/cli/select.rb +0 -126
- data/lib/gloo_lang/objs/data/mysql.rb +0 -192
- data/lib/gloo_lang/objs/data/sqlite.rb +0 -159
- data/lib/gloo_lang/objs/dev/git.rb +0 -140
- data/lib/gloo_lang/objs/dev/stats.rb +0 -120
- data/lib/gloo_lang/objs/snd/play.rb +0 -48
- data/lib/gloo_lang/objs/snd/say.rb +0 -98
- data/lib/gloo_lang/objs/system/file_handle.rb +0 -138
- data/lib/gloo_lang/objs/system/ssh_exec.rb +0 -126
- data/lib/gloo_lang/objs/system/system.rb +0 -136
- data/lib/gloo_lang/verbs/alert.rb +0 -79
- data/lib/gloo_lang/verbs/beep.rb +0 -40
- data/lib/gloo_lang/verbs/cls.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78f880bdd4bdd4c5b796b0bc6a273df959ea129075750649d8c76e1f039d916b
|
4
|
+
data.tar.gz: df8cca545850962ae5151e3307ece3ff9e2cbeed1588c213326cb0ebfdb9c223
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bc34b8d10b6ce580189f868834170015a9d8f5305a02fc99705788c95a852d7e593d8326c3304e4b9a2bbd85faaa4b43b44e37271ac6d7399424b7b3a5a248f
|
7
|
+
data.tar.gz: 0fd7f6347b859d8a945452eaa23f63742c49db49d5c2eb102a28ab3ddee362ef210c83cbbfb004bdae848303a02e514f13318901361660c2a9ff3be6d6ebca1c
|
data/Gemfile.lock
CHANGED
data/gloo-lang.gemspec
CHANGED
@@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
|
33
33
|
spec.add_dependency 'openssl', '~> 2.1', '>= 2.1.0'
|
34
34
|
spec.add_dependency 'net-ssh', '~> 6.1', '>= 6.1.0'
|
35
|
+
spec.add_dependency 'tty-platform', '~> 0.3', '>= 0.3.0'
|
35
36
|
# spec.add_dependency 'mysql2', '~> 0.5', '>= 0.5.3'
|
36
37
|
# spec.add_dependency 'sqlite3', '~> 1.4', '>= 1.4.2'
|
37
38
|
end
|
data/lib/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.7
|
data/lib/gloo_lang/app/args.rb
CHANGED
data/lib/gloo_lang/app/engine.rb
CHANGED
@@ -7,15 +7,11 @@
|
|
7
7
|
# to the relevant element.
|
8
8
|
#
|
9
9
|
|
10
|
-
require 'tty-prompt'
|
11
|
-
require 'tty-cursor'
|
12
|
-
require 'colorize'
|
13
|
-
|
14
10
|
module GlooLang
|
15
11
|
module App
|
16
12
|
class Engine
|
17
13
|
|
18
|
-
attr_reader :args, :mode, :running,
|
14
|
+
attr_reader :args, :mode, :running, :platform,
|
19
15
|
:dictionary, :parser, :heap, :factory
|
20
16
|
attr_accessor :last_cmd, :persist_man, :event_manager,
|
21
17
|
:exec_env, :help, :converter
|
@@ -23,12 +19,15 @@ module GlooLang
|
|
23
19
|
#
|
24
20
|
# Set up the engine with basic elements.
|
25
21
|
#
|
26
|
-
def initialize( params = [] )
|
22
|
+
def initialize( params = [], platform=nil, log=nil )
|
27
23
|
$engine = self
|
28
24
|
@args = Args.new( params )
|
29
25
|
$settings = Settings.new( ENV[ 'GLOO_ENV' ] )
|
30
|
-
|
31
|
-
$
|
26
|
+
|
27
|
+
$log = log ? log : Log.new
|
28
|
+
$log.quiet = @args.quiet?
|
29
|
+
|
30
|
+
@platform = platform ? platform : Platform.new
|
32
31
|
$log.debug 'engine intialized...'
|
33
32
|
end
|
34
33
|
|
@@ -113,23 +112,6 @@ module GlooLang
|
|
113
112
|
@persist_man.load( name ) if name
|
114
113
|
end
|
115
114
|
|
116
|
-
#
|
117
|
-
# Prompt for the next command.
|
118
|
-
#
|
119
|
-
def prompt_cmd
|
120
|
-
@last_cmd = $prompt.ask( default_prompt )
|
121
|
-
end
|
122
|
-
|
123
|
-
#
|
124
|
-
# Get the default prompt text.
|
125
|
-
#
|
126
|
-
def default_prompt
|
127
|
-
dt = DateTime.now
|
128
|
-
d = dt.strftime( '%Y.%m.%d' )
|
129
|
-
t = dt.strftime( '%I:%M:%S' )
|
130
|
-
return "#{'gloo'.blue} #{d.yellow} #{t.white} >"
|
131
|
-
end
|
132
|
-
|
133
115
|
#
|
134
116
|
# Is the last command entered blank?
|
135
117
|
#
|
@@ -145,7 +127,7 @@ module GlooLang
|
|
145
127
|
#
|
146
128
|
def loop
|
147
129
|
while @running
|
148
|
-
prompt_cmd
|
130
|
+
@last_cmd = @platform.prompt_cmd
|
149
131
|
process_cmd
|
150
132
|
end
|
151
133
|
end
|
@@ -155,7 +137,7 @@ module GlooLang
|
|
155
137
|
#
|
156
138
|
def process_cmd
|
157
139
|
if last_cmd_blank?
|
158
|
-
clear_screen
|
140
|
+
@platform.clear_screen
|
159
141
|
return
|
160
142
|
end
|
161
143
|
|
@@ -184,7 +166,7 @@ module GlooLang
|
|
184
166
|
# Show the version information and then quit.
|
185
167
|
#
|
186
168
|
def run_version
|
187
|
-
|
169
|
+
@platform.show Info.display_title unless @args.quiet?
|
188
170
|
quit
|
189
171
|
end
|
190
172
|
|
@@ -196,15 +178,6 @@ module GlooLang
|
|
196
178
|
quit
|
197
179
|
end
|
198
180
|
|
199
|
-
#
|
200
|
-
# Clear the screen.
|
201
|
-
#
|
202
|
-
def clear_screen
|
203
|
-
@cursor ||= TTY::Cursor
|
204
|
-
print @cursor.clear_screen
|
205
|
-
print @cursor.move_to( 0, 0 )
|
206
|
-
end
|
207
|
-
|
208
181
|
# ---------------------------------------------------------------------
|
209
182
|
# Error Handling
|
210
183
|
# ---------------------------------------------------------------------
|
data/lib/gloo_lang/app/help.rb
CHANGED
@@ -4,9 +4,6 @@
|
|
4
4
|
# Help system.
|
5
5
|
#
|
6
6
|
|
7
|
-
require 'tty-markdown'
|
8
|
-
require 'tty-pager'
|
9
|
-
|
10
7
|
module GlooLang
|
11
8
|
module App
|
12
9
|
class Help
|
@@ -61,11 +58,7 @@ module GlooLang
|
|
61
58
|
|
62
59
|
data = self.get_topic_data( topic )
|
63
60
|
page = data.lines.count > Settings.page_size
|
64
|
-
|
65
|
-
show_markdown_data( data, page )
|
66
|
-
else
|
67
|
-
show_text_data( data, page )
|
68
|
-
end
|
61
|
+
$engine.platform.show( data, topic_is_md?( topic ), page )
|
69
62
|
end
|
70
63
|
|
71
64
|
#
|
@@ -75,39 +68,7 @@ module GlooLang
|
|
75
68
|
return if $engine.args.quiet?
|
76
69
|
|
77
70
|
data = self.get_topic_data( topic )
|
78
|
-
|
79
|
-
show_markdown_data data
|
80
|
-
else
|
81
|
-
show_text_data data
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
#
|
86
|
-
# Show the markdown data.
|
87
|
-
#
|
88
|
-
def show_text_data( data, page = false )
|
89
|
-
if page
|
90
|
-
pager = TTY::Pager.new
|
91
|
-
pager.page( data )
|
92
|
-
else
|
93
|
-
puts data.white
|
94
|
-
puts
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
#
|
99
|
-
# Show the markdown data.
|
100
|
-
#
|
101
|
-
def show_markdown_data( data, page = false )
|
102
|
-
md = TTY::Markdown.parse data
|
103
|
-
|
104
|
-
if page
|
105
|
-
pager = TTY::Pager.new
|
106
|
-
pager.page( md )
|
107
|
-
else
|
108
|
-
puts md
|
109
|
-
puts
|
110
|
-
end
|
71
|
+
$engine.platform.show( data, topic_is_md?( topic ), false )
|
111
72
|
end
|
112
73
|
|
113
74
|
#
|
data/lib/gloo_lang/app/log.rb
CHANGED
@@ -4,25 +4,23 @@
|
|
4
4
|
# Application Logging wrapper.
|
5
5
|
#
|
6
6
|
require 'active_support'
|
7
|
-
require 'colorize'
|
8
|
-
require 'colorized_string'
|
9
7
|
|
10
8
|
module GlooLang
|
11
9
|
module App
|
12
10
|
class Log
|
13
11
|
|
14
|
-
attr_reader :logger
|
12
|
+
attr_reader :logger
|
13
|
+
attr_accessor :quiet
|
15
14
|
|
16
15
|
#
|
17
16
|
# Set up a logger.
|
18
17
|
# If quiet is true, then message are written to the log
|
19
18
|
# but not to the console.
|
20
19
|
#
|
21
|
-
def initialize( quiet )
|
20
|
+
def initialize( quiet=true )
|
22
21
|
f = File.join( $settings.log_path, 'gloo.log' )
|
23
22
|
@logger = Logger.new( f )
|
24
23
|
@logger.level = Logger::DEBUG
|
25
|
-
@quiet = quiet
|
26
24
|
end
|
27
25
|
|
28
26
|
#
|
@@ -45,7 +43,7 @@ module GlooLang
|
|
45
43
|
#
|
46
44
|
def info( msg )
|
47
45
|
@logger.info msg
|
48
|
-
puts msg
|
46
|
+
puts msg unless @quiet
|
49
47
|
end
|
50
48
|
|
51
49
|
#
|
@@ -54,7 +52,7 @@ module GlooLang
|
|
54
52
|
#
|
55
53
|
def warn( msg )
|
56
54
|
@logger.warn msg
|
57
|
-
puts msg
|
55
|
+
puts msg unless @quiet
|
58
56
|
end
|
59
57
|
|
60
58
|
#
|
@@ -68,11 +66,11 @@ module GlooLang
|
|
68
66
|
if ex
|
69
67
|
@logger.error ex.message
|
70
68
|
@logger.error ex.backtrace
|
71
|
-
puts msg
|
72
|
-
puts ex.message
|
69
|
+
puts msg unless @quiet
|
70
|
+
puts ex.message unless @quiet
|
73
71
|
puts ex.backtrace unless @quiet
|
74
72
|
else
|
75
|
-
puts msg
|
73
|
+
puts msg unless @quiet
|
76
74
|
end
|
77
75
|
end
|
78
76
|
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# Author:: Eric Crane (mailto:eric.crane@mac.com)
|
2
|
+
# Copyright:: Copyright (c) 2022 Eric Crane. All rights reserved.
|
3
|
+
#
|
4
|
+
# Handle input and output for the current platform.
|
5
|
+
#
|
6
|
+
# This is an abstract base class and minimal implementation
|
7
|
+
# is only to facilitate testing.
|
8
|
+
#
|
9
|
+
|
10
|
+
module GlooLang
|
11
|
+
module App
|
12
|
+
class Platform
|
13
|
+
|
14
|
+
#
|
15
|
+
# Set up Platform.
|
16
|
+
#
|
17
|
+
def initialize
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Show a message.
|
22
|
+
# Abstract--implment in subclass.
|
23
|
+
#
|
24
|
+
def show( msg, md=false, page=false )
|
25
|
+
puts msg
|
26
|
+
end
|
27
|
+
|
28
|
+
#
|
29
|
+
# Prompt for the next command.
|
30
|
+
# Abstract--implment in subclass.
|
31
|
+
#
|
32
|
+
def prompt_cmd
|
33
|
+
return ''
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# Clear the screen.
|
38
|
+
# Abstract--implment in subclass.
|
39
|
+
#
|
40
|
+
def clear_screen
|
41
|
+
end
|
42
|
+
|
43
|
+
#
|
44
|
+
# Edit some temporary text and return the edited text.
|
45
|
+
# Abstract--implment in subclass.
|
46
|
+
#
|
47
|
+
def edit initial_value
|
48
|
+
return initial_value
|
49
|
+
end
|
50
|
+
|
51
|
+
#
|
52
|
+
# Show the given table data.
|
53
|
+
# Abstract--implment in subclass.
|
54
|
+
#
|
55
|
+
def show_table( headers, data, title = nil )
|
56
|
+
end
|
57
|
+
|
58
|
+
#
|
59
|
+
# Get the number of vertical lines on screen.
|
60
|
+
# Abstract--implment in subclass.
|
61
|
+
#
|
62
|
+
def lines
|
63
|
+
return 40
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Get the number of horizontal columns on screen.
|
68
|
+
# Abstract--implment in subclass.
|
69
|
+
#
|
70
|
+
def cols
|
71
|
+
return 80
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -5,8 +5,6 @@
|
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'yaml'
|
8
|
-
require 'tty-screen'
|
9
|
-
require 'colorize'
|
10
8
|
|
11
9
|
module GlooLang
|
12
10
|
module App
|
@@ -48,11 +46,11 @@ module GlooLang
|
|
48
46
|
# Can be seen in app with 'help settings'
|
49
47
|
#
|
50
48
|
def show
|
51
|
-
puts "\nApplication Settings:"
|
52
|
-
puts ' Startup with: '
|
53
|
-
puts ' Indent in Listing: '
|
54
|
-
puts ' Screen Lines: '
|
55
|
-
puts ' Page Size: '
|
49
|
+
puts "\nApplication Settings:"
|
50
|
+
puts ' Startup with: ' + @start_with
|
51
|
+
puts ' Indent in Listing: ' + @list_indent.to_s
|
52
|
+
puts ' Screen Lines: ' + GlooLang::App::Settings.lines.to_s
|
53
|
+
puts ' Page Size: ' + GlooLang::App::Settings.page_size.to_s
|
56
54
|
puts ''
|
57
55
|
self.show_paths
|
58
56
|
puts ''
|
@@ -62,24 +60,49 @@ module GlooLang
|
|
62
60
|
# Show path settings
|
63
61
|
#
|
64
62
|
def show_paths
|
65
|
-
puts ' User Root Path is here: '
|
66
|
-
puts ' Projects Path: '
|
67
|
-
puts ' Tmp Path: '
|
68
|
-
puts ' Debug Path: '
|
63
|
+
puts ' User Root Path is here: ' + @user_root
|
64
|
+
puts ' Projects Path: ' + @project_path
|
65
|
+
puts ' Tmp Path: ' + @tmp_path
|
66
|
+
puts ' Debug Path: ' + @debug_path
|
69
67
|
end
|
70
68
|
|
69
|
+
# #
|
70
|
+
# # Show the current application settings.
|
71
|
+
# # Can be seen in app with 'help settings'
|
72
|
+
# #
|
73
|
+
# def show
|
74
|
+
# puts "\nApplication Settings:".blue
|
75
|
+
# puts ' Startup with: '.yellow + @start_with.white
|
76
|
+
# puts ' Indent in Listing: '.yellow + @list_indent.to_s.white
|
77
|
+
# puts ' Screen Lines: '.yellow + GlooLang::App::Settings.lines.to_s.white
|
78
|
+
# puts ' Page Size: '.yellow + GlooLang::App::Settings.page_size.to_s.white
|
79
|
+
# puts ''
|
80
|
+
# self.show_paths
|
81
|
+
# puts ''
|
82
|
+
# end
|
83
|
+
#
|
84
|
+
# #
|
85
|
+
# # Show path settings
|
86
|
+
# #
|
87
|
+
# def show_paths
|
88
|
+
# puts ' User Root Path is here: '.yellow + @user_root.white
|
89
|
+
# puts ' Projects Path: '.yellow + @project_path.white
|
90
|
+
# puts ' Tmp Path: '.yellow + @tmp_path.white
|
91
|
+
# puts ' Debug Path: '.yellow + @debug_path.white
|
92
|
+
# end
|
93
|
+
|
71
94
|
#
|
72
95
|
# Get the number of vertical lines on screen.
|
73
96
|
#
|
74
97
|
def self.lines
|
75
|
-
|
98
|
+
$engine.platform.lines
|
76
99
|
end
|
77
100
|
|
78
101
|
#
|
79
102
|
# Get the number of horizontal columns on screen.
|
80
103
|
#
|
81
104
|
def self.cols
|
82
|
-
|
105
|
+
$engine.platform.cols
|
83
106
|
end
|
84
107
|
|
85
108
|
#
|
@@ -3,8 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# An object that contains a collection of other objects.
|
5
5
|
#
|
6
|
-
require 'tty-table'
|
7
|
-
require 'pastel'
|
8
6
|
|
9
7
|
module GlooLang
|
10
8
|
module Objs
|
@@ -59,16 +57,7 @@ module GlooLang
|
|
59
57
|
#
|
60
58
|
def msg_show_key_value_table
|
61
59
|
data = self.children.map { |o| [ o.name, o.value ] }
|
62
|
-
|
63
|
-
table = TTY::Table.new rows: data
|
64
|
-
pad = [ 0, 1, 0, 1 ]
|
65
|
-
rendered = table.render( :ascii, indent: 2, padding: pad ) do |r|
|
66
|
-
r.border.style = :blue
|
67
|
-
r.filter = proc do |val, _row_index, col_index|
|
68
|
-
col_index.zero? ? pastel.blue( val ) : pastel.white( val )
|
69
|
-
end
|
70
|
-
end
|
71
|
-
puts "\n #{rendered}\n\n"
|
60
|
+
$engine.platform.show_table nil, data, title
|
72
61
|
end
|
73
62
|
|
74
63
|
end
|
@@ -3,8 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# A [multiline] block of text.
|
5
5
|
#
|
6
|
-
require 'tty-editor'
|
7
|
-
require 'tty-pager'
|
8
6
|
|
9
7
|
module GlooLang
|
10
8
|
module Objs
|
@@ -12,7 +10,6 @@ module GlooLang
|
|
12
10
|
|
13
11
|
KEYWORD = 'text'.freeze
|
14
12
|
KEYWORD_SHORT = 'txt'.freeze
|
15
|
-
DEFAULT_TMP_FILE = 'tmp.txt'.freeze
|
16
13
|
|
17
14
|
#
|
18
15
|
# The name of the object type.
|
@@ -67,19 +64,14 @@ module GlooLang
|
|
67
64
|
def msg_page
|
68
65
|
return unless value
|
69
66
|
|
70
|
-
|
71
|
-
pager = TTY::Pager.new
|
72
|
-
pager.page( value )
|
67
|
+
$engine.platform.show( value, false, true )
|
73
68
|
end
|
74
69
|
|
75
70
|
#
|
76
71
|
# Edit the text in the default editor.
|
77
72
|
#
|
78
73
|
def msg_edit
|
79
|
-
|
80
|
-
File.open( tmp, 'w' ) { |file| file.write( self.value ) }
|
81
|
-
TTY::Editor.open( tmp )
|
82
|
-
set_value File.read( tmp )
|
74
|
+
self.value = $engine.platform.edit( self.value )
|
83
75
|
end
|
84
76
|
|
85
77
|
end
|
@@ -3,8 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# Markdown data.
|
5
5
|
#
|
6
|
-
require 'tty-markdown'
|
7
|
-
require 'tty-pager'
|
8
6
|
|
9
7
|
module GlooLang
|
10
8
|
module Objs
|
@@ -64,7 +62,7 @@ module GlooLang
|
|
64
62
|
# Show the markdown data in the terminal.
|
65
63
|
#
|
66
64
|
def msg_show
|
67
|
-
|
65
|
+
$engine.platform.show( self.value, true, false )
|
68
66
|
end
|
69
67
|
|
70
68
|
#
|
@@ -73,10 +71,7 @@ module GlooLang
|
|
73
71
|
def msg_page
|
74
72
|
return unless self.value
|
75
73
|
|
76
|
-
md
|
77
|
-
# pager = TTY::Pager::SystemPager.new command: 'less -R'
|
78
|
-
pager = TTY::Pager.new
|
79
|
-
pager.page( md )
|
74
|
+
$engine.platform.show( md, true, true )
|
80
75
|
end
|
81
76
|
|
82
77
|
end
|
@@ -4,8 +4,6 @@
|
|
4
4
|
# A data table.
|
5
5
|
# The table container headers and data.
|
6
6
|
#
|
7
|
-
require 'tty-table'
|
8
|
-
require 'pastel'
|
9
7
|
|
10
8
|
module GlooLang
|
11
9
|
module Objs
|
@@ -106,33 +104,7 @@ module GlooLang
|
|
106
104
|
#
|
107
105
|
def msg_show
|
108
106
|
title = self.value
|
109
|
-
|
110
|
-
end
|
111
|
-
|
112
|
-
# ---------------------------------------------------------------------
|
113
|
-
# Static table helper
|
114
|
-
# ---------------------------------------------------------------------
|
115
|
-
|
116
|
-
#
|
117
|
-
# Show the given table data.
|
118
|
-
#
|
119
|
-
def self.show( headers, data, title = nil )
|
120
|
-
pastel = ::Pastel.new
|
121
|
-
table = TTY::Table.new headers, data
|
122
|
-
pad = [ 0, 1, 0, 1 ]
|
123
|
-
rendered = table.render( :ascii, indent: 2, padding: pad ) do |r|
|
124
|
-
r.border.style = :blue
|
125
|
-
r.filter = proc do |val, row_index, _col_index|
|
126
|
-
# col_index % 2 == 1 ? pastel.red.on_green(val) : val
|
127
|
-
if row_index.zero?
|
128
|
-
pastel.blue( val )
|
129
|
-
else
|
130
|
-
row_index.odd? ? pastel.white( val ) : pastel.yellow( val )
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
puts "\n#{title.white}"
|
135
|
-
puts "#{rendered}\n\n"
|
107
|
+
$engine.platform.show_table headers, data, title
|
136
108
|
end
|
137
109
|
|
138
110
|
end
|
data/lib/gloo_lang/verbs/show.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# Show a single object's value.
|
5
5
|
#
|
6
|
-
require 'colorized_string'
|
6
|
+
# require 'colorized_string'
|
7
7
|
|
8
8
|
module GlooLang
|
9
9
|
module Verbs
|
@@ -54,7 +54,8 @@ module GlooLang
|
|
54
54
|
expr = GlooLang::Expr::Expression.new( @params.tokens )
|
55
55
|
val = expr.evaluate
|
56
56
|
color = val.to_sym
|
57
|
-
return ColorizedString[ str.to_s ].colorize( color )
|
57
|
+
# return ColorizedString[ str.to_s ].colorize( color )
|
58
|
+
return str.to_s
|
58
59
|
end
|
59
60
|
return str
|
60
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gloo-lang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Crane
|
@@ -138,6 +138,26 @@ dependencies:
|
|
138
138
|
- - ">="
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: 6.1.0
|
141
|
+
- !ruby/object:Gem::Dependency
|
142
|
+
name: tty-platform
|
143
|
+
requirement: !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
145
|
+
- - "~>"
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: '0.3'
|
148
|
+
- - ">="
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 0.3.0
|
151
|
+
type: :runtime
|
152
|
+
prerelease: false
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0.3'
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: 0.3.0
|
141
161
|
description: A scripting languge to keep it all together.
|
142
162
|
email:
|
143
163
|
- eric.crane@mac.com
|
@@ -164,6 +184,7 @@ files:
|
|
164
184
|
- lib/gloo_lang/app/info.rb
|
165
185
|
- lib/gloo_lang/app/log.rb
|
166
186
|
- lib/gloo_lang/app/mode.rb
|
187
|
+
- lib/gloo_lang/app/platform.rb
|
167
188
|
- lib/gloo_lang/app/settings.rb
|
168
189
|
- lib/gloo_lang/convert/converter.rb
|
169
190
|
- lib/gloo_lang/convert/string_to_datetime.rb
|
@@ -285,34 +306,16 @@ files:
|
|
285
306
|
- lib/gloo_lang/objs/basic/string.rb
|
286
307
|
- lib/gloo_lang/objs/basic/text.rb
|
287
308
|
- lib/gloo_lang/objs/basic/untyped.rb
|
288
|
-
- lib/gloo_lang/objs/cli/banner.rb
|
289
|
-
- lib/gloo_lang/objs/cli/bar.rb
|
290
|
-
- lib/gloo_lang/objs/cli/colorize.rb
|
291
|
-
- lib/gloo_lang/objs/cli/confirm.rb
|
292
|
-
- lib/gloo_lang/objs/cli/menu.rb
|
293
|
-
- lib/gloo_lang/objs/cli/menu_item.rb
|
294
|
-
- lib/gloo_lang/objs/cli/pastel.rb
|
295
|
-
- lib/gloo_lang/objs/cli/prompt.rb
|
296
|
-
- lib/gloo_lang/objs/cli/select.rb
|
297
309
|
- lib/gloo_lang/objs/ctrl/each.rb
|
298
310
|
- lib/gloo_lang/objs/ctrl/repeat.rb
|
299
311
|
- lib/gloo_lang/objs/data/markdown.rb
|
300
|
-
- lib/gloo_lang/objs/data/mysql.rb
|
301
312
|
- lib/gloo_lang/objs/data/query.rb
|
302
|
-
- lib/gloo_lang/objs/data/sqlite.rb
|
303
313
|
- lib/gloo_lang/objs/data/table.rb
|
304
|
-
- lib/gloo_lang/objs/dev/git.rb
|
305
|
-
- lib/gloo_lang/objs/dev/stats.rb
|
306
314
|
- lib/gloo_lang/objs/dt/date.rb
|
307
315
|
- lib/gloo_lang/objs/dt/datetime.rb
|
308
316
|
- lib/gloo_lang/objs/dt/time.rb
|
309
317
|
- lib/gloo_lang/objs/ror/erb.rb
|
310
318
|
- lib/gloo_lang/objs/ror/eval.rb
|
311
|
-
- lib/gloo_lang/objs/snd/play.rb
|
312
|
-
- lib/gloo_lang/objs/snd/say.rb
|
313
|
-
- lib/gloo_lang/objs/system/file_handle.rb
|
314
|
-
- lib/gloo_lang/objs/system/ssh_exec.rb
|
315
|
-
- lib/gloo_lang/objs/system/system.rb
|
316
319
|
- lib/gloo_lang/objs/web/http_get.rb
|
317
320
|
- lib/gloo_lang/objs/web/http_post.rb
|
318
321
|
- lib/gloo_lang/objs/web/json.rb
|
@@ -327,9 +330,6 @@ files:
|
|
327
330
|
- lib/gloo_lang/utils/format.rb
|
328
331
|
- lib/gloo_lang/utils/stats.rb
|
329
332
|
- lib/gloo_lang/utils/words.rb
|
330
|
-
- lib/gloo_lang/verbs/alert.rb
|
331
|
-
- lib/gloo_lang/verbs/beep.rb
|
332
|
-
- lib/gloo_lang/verbs/cls.rb
|
333
333
|
- lib/gloo_lang/verbs/context.rb
|
334
334
|
- lib/gloo_lang/verbs/create.rb
|
335
335
|
- lib/gloo_lang/verbs/execute.rb
|