natty-ui 0.8.0 → 0.9.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/.yardopts +3 -2
- data/examples/24bit-colors.rb +11 -7
- data/examples/3bit-colors.rb +3 -2
- data/examples/8bit-colors.rb +2 -2
- data/examples/animate.rb +24 -0
- data/examples/attributes.rb +20 -65
- data/examples/demo.rb +39 -203
- data/examples/illustration.rb +27 -23
- data/examples/{list_in_columns.rb → ls.rb} +11 -11
- data/examples/message.rb +30 -0
- data/examples/progress.rb +2 -2
- data/examples/query.rb +6 -2
- data/examples/read_key.rb +13 -0
- data/examples/table.rb +26 -8
- data/lib/natty-ui/ansi.rb +364 -328
- data/lib/natty-ui/ansi_constants.rb +73 -0
- data/lib/natty-ui/ansi_wrapper.rb +68 -23
- data/lib/natty-ui/key_map.rb +119 -0
- data/lib/natty-ui/line_animation/default.rb +35 -0
- data/lib/natty-ui/line_animation/matrix.rb +28 -0
- data/lib/natty-ui/line_animation/rainbow.rb +30 -0
- data/lib/natty-ui/line_animation/test.rb +29 -0
- data/lib/natty-ui/line_animation/type_writer.rb +64 -0
- data/lib/natty-ui/line_animation.rb +54 -0
- data/lib/natty-ui/version.rb +1 -1
- data/lib/natty-ui/wrapper/animate.rb +17 -0
- data/lib/natty-ui/wrapper/ask.rb +2 -8
- data/lib/natty-ui/wrapper/framed.rb +26 -21
- data/lib/natty-ui/wrapper/heading.rb +1 -1
- data/lib/natty-ui/wrapper/horizontal_rule.rb +3 -3
- data/lib/natty-ui/wrapper/list_in_columns.rb +7 -4
- data/lib/natty-ui/wrapper/message.rb +4 -4
- data/lib/natty-ui/wrapper/progress.rb +33 -8
- data/lib/natty-ui/wrapper/query.rb +9 -13
- data/lib/natty-ui/wrapper/request.rb +2 -2
- data/lib/natty-ui/wrapper/section.rb +25 -11
- data/lib/natty-ui/wrapper/table.rb +11 -11
- data/lib/natty-ui/wrapper.rb +19 -14
- data/lib/natty-ui.rb +64 -32
- metadata +16 -5
- data/examples/illustration.png +0 -0
data/examples/table.rb
CHANGED
@@ -1,18 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../lib/natty-ui'
|
4
4
|
|
5
|
-
|
5
|
+
ui.space
|
6
|
+
ui.h1 'NattyUI: Tables'
|
7
|
+
ui.space
|
8
|
+
|
9
|
+
ui.message 'Constructed Table' do
|
10
|
+
ui.table type: :heavy do |table|
|
11
|
+
table.add 'X', 'O'
|
12
|
+
table.add 'O', 'O', 'X'
|
13
|
+
table.add nil, 'X'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
ui.space
|
6
18
|
|
19
|
+
User = Struct.new(:id, :name, :mail, :notes)
|
7
20
|
USERS = [
|
8
|
-
User.new(
|
9
|
-
|
21
|
+
User.new(
|
22
|
+
1,
|
23
|
+
'Henry',
|
24
|
+
'henry@some.test',
|
25
|
+
'This is fill text to generate a wide column which maybe rendered as multi line.'
|
26
|
+
),
|
27
|
+
User.new(2, 'Sam', 'sam-sam@some.test', "enforced\nmulti-line"),
|
10
28
|
User.new(3, 'Taylor', 'taylor@some.test'),
|
11
29
|
User.new(3, 'Max', 'maxxx@some.test')
|
12
30
|
].freeze
|
13
31
|
|
14
|
-
ui.
|
15
|
-
ui.
|
16
|
-
|
32
|
+
ui.message 'Data Table' do
|
33
|
+
ui.table(User.members, *USERS)
|
34
|
+
end
|
17
35
|
|
18
|
-
ui.
|
36
|
+
ui.space
|