ruby_rich 0.3.1 → 0.4.1
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/lib/ruby_rich/agent_shell.rb +254 -0
- data/lib/ruby_rich/ansi_code.rb +46 -0
- data/lib/ruby_rich/app_shell.rb +374 -0
- data/lib/ruby_rich/attachment.rb +25 -0
- data/lib/ruby_rich/columns.rb +244 -0
- data/lib/ruby_rich/composer.rb +512 -0
- data/lib/ruby_rich/console.rb +191 -29
- data/lib/ruby_rich/dialog.rb +2 -1
- data/lib/ruby_rich/event.rb +29 -0
- data/lib/ruby_rich/focus_manager.rb +77 -0
- data/lib/ruby_rich/layout.rb +117 -29
- data/lib/ruby_rich/line_editor.rb +325 -0
- data/lib/ruby_rich/live.rb +100 -19
- data/lib/ruby_rich/markdown.rb +213 -0
- data/lib/ruby_rich/panel.rb +1 -1
- data/lib/ruby_rich/print.rb +6 -6
- data/lib/ruby_rich/progress_bar.rb +229 -11
- data/lib/ruby_rich/progress_manager.rb +150 -0
- data/lib/ruby_rich/sidebar.rb +85 -0
- data/lib/ruby_rich/slash_input.rb +197 -0
- data/lib/ruby_rich/status.rb +246 -0
- data/lib/ruby_rich/syntax.rb +171 -0
- data/lib/ruby_rich/table.rb +167 -21
- data/lib/ruby_rich/terminal.rb +510 -0
- data/lib/ruby_rich/text.rb +112 -2
- data/lib/ruby_rich/theme.rb +96 -0
- data/lib/ruby_rich/tool_block.rb +92 -0
- data/lib/ruby_rich/transcript.rb +553 -0
- data/lib/ruby_rich/tree.rb +200 -0
- data/lib/ruby_rich/version.rb +1 -1
- data/lib/ruby_rich/viewport.rb +468 -0
- data/lib/ruby_rich.rb +65 -10
- metadata +93 -3
data/lib/ruby_rich.rb
CHANGED
|
@@ -1,40 +1,95 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Load all dependency gems
|
|
4
|
+
require 'logger'
|
|
4
5
|
require 'rouge'
|
|
5
6
|
require 'tty-cursor'
|
|
6
7
|
require 'tty-screen'
|
|
7
8
|
require 'redcarpet'
|
|
8
9
|
|
|
9
|
-
#
|
|
10
|
+
# Load all internal modules
|
|
10
11
|
require_relative 'ruby_rich/console'
|
|
12
|
+
require_relative 'ruby_rich/event'
|
|
13
|
+
require_relative 'ruby_rich/terminal'
|
|
11
14
|
require_relative 'ruby_rich/table'
|
|
12
15
|
require_relative 'ruby_rich/progress_bar'
|
|
16
|
+
require_relative 'ruby_rich/progress_manager'
|
|
13
17
|
require_relative 'ruby_rich/layout'
|
|
14
18
|
require_relative 'ruby_rich/live'
|
|
15
19
|
require_relative 'ruby_rich/text'
|
|
16
20
|
require_relative 'ruby_rich/print'
|
|
17
21
|
require_relative 'ruby_rich/panel'
|
|
18
22
|
require_relative 'ruby_rich/dialog'
|
|
23
|
+
require_relative 'ruby_rich/syntax'
|
|
24
|
+
require_relative 'ruby_rich/markdown'
|
|
25
|
+
require_relative 'ruby_rich/tree'
|
|
26
|
+
require_relative 'ruby_rich/columns'
|
|
27
|
+
require_relative 'ruby_rich/status'
|
|
19
28
|
require_relative 'ruby_rich/ansi_code'
|
|
29
|
+
require_relative 'ruby_rich/theme'
|
|
30
|
+
require_relative 'ruby_rich/slash_input'
|
|
31
|
+
require_relative 'ruby_rich/attachment'
|
|
32
|
+
require_relative 'ruby_rich/line_editor'
|
|
33
|
+
require_relative 'ruby_rich/tool_block'
|
|
34
|
+
require_relative 'ruby_rich/viewport'
|
|
35
|
+
require_relative 'ruby_rich/composer'
|
|
36
|
+
require_relative 'ruby_rich/focus_manager'
|
|
37
|
+
require_relative 'ruby_rich/transcript'
|
|
38
|
+
require_relative 'ruby_rich/sidebar'
|
|
39
|
+
require_relative 'ruby_rich/app_shell'
|
|
40
|
+
require_relative 'ruby_rich/agent_shell'
|
|
20
41
|
require_relative 'ruby_rich/version'
|
|
21
42
|
|
|
22
|
-
#
|
|
43
|
+
# Define main module
|
|
23
44
|
module RubyRich
|
|
24
45
|
class Error < StandardError; end
|
|
25
|
-
|
|
26
|
-
#
|
|
46
|
+
|
|
47
|
+
# Provide a convenient method to create console instance
|
|
27
48
|
def self.console
|
|
28
49
|
@console ||= Console.new
|
|
29
50
|
end
|
|
30
51
|
|
|
31
|
-
#
|
|
52
|
+
# Provide a convenient method to create rich text
|
|
32
53
|
def self.text(content = '')
|
|
33
54
|
RichText.new(content)
|
|
34
55
|
end
|
|
35
56
|
|
|
36
|
-
#
|
|
37
|
-
def self.table
|
|
38
|
-
Table.new
|
|
57
|
+
# Provide a convenient method to create table
|
|
58
|
+
def self.table(border_style: :none)
|
|
59
|
+
Table.new(border_style: border_style)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Provide a convenient method for syntax highlighting
|
|
63
|
+
def self.syntax(code, language = nil, theme: :default)
|
|
64
|
+
Syntax.highlight(code, language, theme: theme)
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
# Provide a convenient method to render Markdown
|
|
68
|
+
def self.markdown(text, options = {})
|
|
69
|
+
Markdown.render(text, options)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Provide a convenient method to create tree structure
|
|
73
|
+
def self.tree(root_name = 'Root', style: :default)
|
|
74
|
+
Tree.new(root_name, style: style)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Provide a convenient method to create multi-column layout
|
|
78
|
+
def self.columns(total_width: 80, gutter_width: 2)
|
|
79
|
+
Columns.new(total_width: total_width, gutter_width: gutter_width)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Provide a convenient method to create status indicator
|
|
83
|
+
def self.status(type, **options)
|
|
84
|
+
Status.indicator(type, **options)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def self.logger=(logger)
|
|
88
|
+
@logger = logger
|
|
89
|
+
end
|
|
90
|
+
def self.logger
|
|
91
|
+
@logger ||= Logger.new($stdout).tap do |log|
|
|
92
|
+
log.progname = "Ruby Rich"
|
|
93
|
+
end
|
|
39
94
|
end
|
|
40
|
-
end
|
|
95
|
+
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_rich
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- zhuang biaowei
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rake
|
|
@@ -37,6 +37,76 @@ dependencies:
|
|
|
37
37
|
- - "~>"
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '5.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: rouge
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: 4.5.2
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 4.5.2
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: tty-cursor
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: 0.7.1
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 0.7.1
|
|
68
|
+
- !ruby/object:Gem::Dependency
|
|
69
|
+
name: tty-screen
|
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 0.8.2
|
|
75
|
+
type: :runtime
|
|
76
|
+
prerelease: false
|
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: 0.8.2
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: redcarpet
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: 3.6.1
|
|
89
|
+
type: :runtime
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - "~>"
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: 3.6.1
|
|
96
|
+
- !ruby/object:Gem::Dependency
|
|
97
|
+
name: unicode-display_width
|
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - "~>"
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: 3.1.4
|
|
103
|
+
type: :runtime
|
|
104
|
+
prerelease: false
|
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
106
|
+
requirements:
|
|
107
|
+
- - "~>"
|
|
108
|
+
- !ruby/object:Gem::Version
|
|
109
|
+
version: 3.1.4
|
|
40
110
|
description: A Ruby gem providing rich text formatting, progress bars, tables and
|
|
41
111
|
other console output enhancements
|
|
42
112
|
email: zbw@kaiyuanshe.org
|
|
@@ -45,17 +115,37 @@ extensions: []
|
|
|
45
115
|
extra_rdoc_files: []
|
|
46
116
|
files:
|
|
47
117
|
- lib/ruby_rich.rb
|
|
118
|
+
- lib/ruby_rich/agent_shell.rb
|
|
48
119
|
- lib/ruby_rich/ansi_code.rb
|
|
120
|
+
- lib/ruby_rich/app_shell.rb
|
|
121
|
+
- lib/ruby_rich/attachment.rb
|
|
122
|
+
- lib/ruby_rich/columns.rb
|
|
123
|
+
- lib/ruby_rich/composer.rb
|
|
49
124
|
- lib/ruby_rich/console.rb
|
|
50
125
|
- lib/ruby_rich/dialog.rb
|
|
126
|
+
- lib/ruby_rich/event.rb
|
|
127
|
+
- lib/ruby_rich/focus_manager.rb
|
|
51
128
|
- lib/ruby_rich/layout.rb
|
|
129
|
+
- lib/ruby_rich/line_editor.rb
|
|
52
130
|
- lib/ruby_rich/live.rb
|
|
131
|
+
- lib/ruby_rich/markdown.rb
|
|
53
132
|
- lib/ruby_rich/panel.rb
|
|
54
133
|
- lib/ruby_rich/print.rb
|
|
55
134
|
- lib/ruby_rich/progress_bar.rb
|
|
135
|
+
- lib/ruby_rich/progress_manager.rb
|
|
136
|
+
- lib/ruby_rich/sidebar.rb
|
|
137
|
+
- lib/ruby_rich/slash_input.rb
|
|
138
|
+
- lib/ruby_rich/status.rb
|
|
139
|
+
- lib/ruby_rich/syntax.rb
|
|
56
140
|
- lib/ruby_rich/table.rb
|
|
141
|
+
- lib/ruby_rich/terminal.rb
|
|
57
142
|
- lib/ruby_rich/text.rb
|
|
143
|
+
- lib/ruby_rich/theme.rb
|
|
144
|
+
- lib/ruby_rich/tool_block.rb
|
|
145
|
+
- lib/ruby_rich/transcript.rb
|
|
146
|
+
- lib/ruby_rich/tree.rb
|
|
58
147
|
- lib/ruby_rich/version.rb
|
|
148
|
+
- lib/ruby_rich/viewport.rb
|
|
59
149
|
homepage: https://github.com/zhuangbiaowei/ruby_rich
|
|
60
150
|
licenses:
|
|
61
151
|
- MIT
|
|
@@ -74,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
74
164
|
- !ruby/object:Gem::Version
|
|
75
165
|
version: '0'
|
|
76
166
|
requirements: []
|
|
77
|
-
rubygems_version:
|
|
167
|
+
rubygems_version: 4.0.10
|
|
78
168
|
specification_version: 4
|
|
79
169
|
summary: Rich text formatting and console output for Ruby
|
|
80
170
|
test_files: []
|