terminal-basic-menu 1.0.0 → 1.1.0
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/terminal-basic-menu.rb +4 -3
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6ba7ab6f840b938c832e2ed46e003ab3d41e9c679f56a61a8be81e80511c1ed
|
4
|
+
data.tar.gz: 993d4e66085300f166d34129c3b8fb066cd18dac1238710a98294330267ea1b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09c49d68d555b48549c5fe24064ec6480e3c38aab7aa209631fbfc3e58861269361c936c470f0cbad4711dc29e65e3e97079955a91ea0f7cb2246c32d283ec45'
|
7
|
+
data.tar.gz: 2bd365abe65bfa4ec3d11e842d94494673bcb3890e2e97c5d6ca760140c56ae78e097d02a55b651ddd066e1d79b0031a9abd2e99cbe232cc3fd996642f5a6efd
|
data/lib/terminal-basic-menu.rb
CHANGED
@@ -3,7 +3,8 @@ require 'rainbow'
|
|
3
3
|
# Basic menu class used to create an instance of a terminal menu
|
4
4
|
class Menu
|
5
5
|
attr_accessor :width, :header, :body, :footer, :border_color, :word_wrap, :block_align
|
6
|
-
def initialize(width: 50, header: nil, body: nil, footer: nil, border_color: 0)
|
6
|
+
def initialize(output: $stdout, width: 50, header: nil, body: nil, footer: nil, border_color: 0)
|
7
|
+
@output = output
|
7
8
|
@width = width - 4 # adjust to allow '| ' and ' |' on each side
|
8
9
|
@header = header
|
9
10
|
@body = body
|
@@ -66,7 +67,7 @@ class Menu
|
|
66
67
|
output = Rainbow('| ').fg(border_color)
|
67
68
|
output += Rainbow(line.ljust(max_length).send(align, @width)).fg(color)
|
68
69
|
output += Rainbow(' |').fg(border_color)
|
69
|
-
puts output
|
70
|
+
@output.puts output
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
@@ -75,7 +76,7 @@ class Menu
|
|
75
76
|
end
|
76
77
|
|
77
78
|
def print_line_break
|
78
|
-
puts Rainbow('+' + '-' * (@width + 2) + '+').color(border_color)
|
79
|
+
@output.puts Rainbow('+' + '-' * (@width + 2) + '+').color(border_color)
|
79
80
|
end
|
80
81
|
|
81
82
|
def word_wrap(text)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terminal-basic-menu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Armour
|
@@ -14,22 +14,22 @@ dependencies:
|
|
14
14
|
name: rainbow
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.0'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: 3.0.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.0'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: 3.0.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
33
|
description: A simple gem used to create and display menus for terminal apps.
|
34
34
|
email: agrobmonkey@gmail.com
|
35
35
|
executables: []
|
@@ -56,8 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
requirements: []
|
59
|
-
|
60
|
-
rubygems_version: 2.7.7
|
59
|
+
rubygems_version: 3.0.3
|
61
60
|
signing_key:
|
62
61
|
specification_version: 4
|
63
62
|
summary: A basic menu for terminal apps
|