fatty 0.99.4 → 0.99.5
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/fatty/ansi/renderer.rb +7 -0
- data/lib/fatty/api/output.rb +24 -4
- data/lib/fatty/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9bc94398dc11c48330c27d9a4e72197c0d0cbb402b426b248d1f0c3cc4d910fa
|
|
4
|
+
data.tar.gz: 112dbdaa9afb4e637dc405f2a8f69f73afea6375878604cc952598b498bf1ed9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f47fc3c3e387c39d761022f06fb8486a692ef7b20b81bd97aaa00e250d6f05b06f4f57f3a7a24963e007b6ec56aaf598db6d7ac0991909bf0995529170f2546f
|
|
7
|
+
data.tar.gz: 2debc225cd6ee1e2a3dc7f14e4f6951f0d1263b01db556fdac9a7f50101ef27a737a7f13495707bc656ac90baebbc57e53819c92f0735888e81ea3ef8c5b2749
|
data/lib/fatty/ansi/renderer.rb
CHANGED
|
@@ -9,6 +9,13 @@ module Fatty
|
|
|
9
9
|
@io = io
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
def style(text, role:, palette:)
|
|
13
|
+
spec = palette&.[](role.to_sym)
|
|
14
|
+
return text.to_s unless spec
|
|
15
|
+
|
|
16
|
+
"#{sgr_for_spec(spec)}#{text}#{reset}"
|
|
17
|
+
end
|
|
18
|
+
|
|
12
19
|
def render_line(row:, col:, width:, text:, role:, palette:)
|
|
13
20
|
spec = palette&.[](role)
|
|
14
21
|
return unless spec
|
data/lib/fatty/api/output.rb
CHANGED
|
@@ -2,13 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
module Fatty
|
|
4
4
|
module OutputApi
|
|
5
|
-
def append(text, follow: true)
|
|
6
|
-
|
|
5
|
+
def append(text, follow: true, role: nil)
|
|
6
|
+
payload = {
|
|
7
|
+
text: output_text(text, role: role),
|
|
8
|
+
follow: follow,
|
|
9
|
+
}
|
|
10
|
+
queue(Command.session(output_id, :append, **payload))
|
|
7
11
|
nil
|
|
8
12
|
end
|
|
9
13
|
|
|
10
|
-
def append_now(text, follow: true, mode: nil)
|
|
11
|
-
payload = {
|
|
14
|
+
def append_now(text, follow: true, mode: nil, role: nil)
|
|
15
|
+
payload = {
|
|
16
|
+
text: output_text(text, role: role),
|
|
17
|
+
follow: follow,
|
|
18
|
+
}
|
|
12
19
|
payload[:mode] = mode if mode
|
|
13
20
|
|
|
14
21
|
terminal.apply_command(Command.session(output_id, :append, **payload))
|
|
@@ -30,6 +37,19 @@ module Fatty
|
|
|
30
37
|
|
|
31
38
|
private
|
|
32
39
|
|
|
40
|
+
def output_text(text, role:)
|
|
41
|
+
text = text.to_s
|
|
42
|
+
if role
|
|
43
|
+
Fatty::Ansi::Renderer.new.style(
|
|
44
|
+
text,
|
|
45
|
+
role: role,
|
|
46
|
+
palette: markdown_palette,
|
|
47
|
+
)
|
|
48
|
+
else
|
|
49
|
+
text
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
33
53
|
def markdown_palette
|
|
34
54
|
terminal.renderer.palette if terminal.respond_to?(:renderer) && terminal.renderer
|
|
35
55
|
end
|
data/lib/fatty/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fatty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.99.
|
|
4
|
+
version: 0.99.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel E. Doherty
|
|
@@ -246,7 +246,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
246
246
|
- !ruby/object:Gem::Version
|
|
247
247
|
version: '0'
|
|
248
248
|
requirements: []
|
|
249
|
-
rubygems_version: 4.0.
|
|
249
|
+
rubygems_version: 4.0.17
|
|
250
250
|
specification_version: 4
|
|
251
251
|
summary: Stateful terminal UI with editable input and scrollback
|
|
252
252
|
test_files: []
|