output_mode 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/demo +12 -2
- data/lib/output_mode/tldr/index.rb +7 -3
- data/lib/output_mode/tldr/show.rb +7 -3
- data/lib/output_mode/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: 2ad0728b37cf092a7e009021655552acae2f4493b66bafa17509efc0e0740435
|
4
|
+
data.tar.gz: 96875c08fa06eb7b868e7d4069965d6704e75ac126917fba5fb7e0f78cf4ff2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b104681823f3d151875c4ebfef4eac7c98f64657fe0f40fb49776bd969095da7310dbe7d3119a49e92c758e71521d8b84de52636766efdfbae4c8e5b3a19b78
|
7
|
+
data.tar.gz: 44f52488f5131c0c82df6ef4a272f75dd01f43c97c0c9e04c77f6e7df79968b04ef10af3d6ff2acc526fb7796782ab38b0ad7acc336de2868ff992314d70e4ac
|
data/bin/demo
CHANGED
@@ -74,6 +74,12 @@ puts <<~EOF
|
|
74
74
|
#==============================================================================
|
75
75
|
#==============================================================================
|
76
76
|
|
77
|
+
#==============================================================================
|
78
|
+
# Default Demo Index
|
79
|
+
# Simplified in interactive shells, verbose in non-interactive
|
80
|
+
#==============================================================================
|
81
|
+
#{DemoIndex.build_output.render(*data)}
|
82
|
+
|
77
83
|
#==============================================================================
|
78
84
|
# Demo Verbose Index
|
79
85
|
#==============================================================================
|
@@ -81,7 +87,6 @@ puts <<~EOF
|
|
81
87
|
|
82
88
|
#==============================================================================
|
83
89
|
# Demo "Simplified" Index
|
84
|
-
# NOTE: Disabled for non-interactive shell, shows the verbose output instead
|
85
90
|
#==============================================================================
|
86
91
|
#{DemoIndex.build_output(verbose: false).render(*data)}
|
87
92
|
|
@@ -108,6 +113,12 @@ puts <<~EOF
|
|
108
113
|
#==============================================================================
|
109
114
|
#==============================================================================
|
110
115
|
|
116
|
+
#==============================================================================
|
117
|
+
# Default Settings
|
118
|
+
# Simplified in interactive shells, verbose in non-interactive
|
119
|
+
#==============================================================================
|
120
|
+
#{DemoShow.build_output.render(*data)}
|
121
|
+
|
111
122
|
#==============================================================================
|
112
123
|
# Demo Verbose Show
|
113
124
|
#==============================================================================
|
@@ -115,7 +126,6 @@ puts <<~EOF
|
|
115
126
|
|
116
127
|
#==============================================================================
|
117
128
|
# Demo "Simplified" Show
|
118
|
-
# NOTE: Disabled for non-interactive shell, shows the verbose output instead
|
119
129
|
#==============================================================================
|
120
130
|
#{DemoShow.build_output(verbose: false).render(*data)}
|
121
131
|
|
@@ -65,8 +65,12 @@ module OutputMode
|
|
65
65
|
#
|
66
66
|
# An interative/ non-interactive output can be forced by setting the
|
67
67
|
# +interactive+ flag to +true+/+false+ respectively
|
68
|
-
def build_output(verbose:
|
69
|
-
|
68
|
+
def build_output(verbose: nil, ascii: false, interactive: nil, header_color: [:blue, :bold], row_color: :green)
|
69
|
+
# Set the interactive and verbose flags if not provided
|
70
|
+
interactive = $stdout.tty? if interactive.nil?
|
71
|
+
verbose = !interactive if verbose.nil?
|
72
|
+
|
73
|
+
callables = if verbose
|
70
74
|
# Filter out columns that are explicitly not verbose
|
71
75
|
output_callables.select { |o| o.verbose?(true) }
|
72
76
|
else
|
@@ -74,7 +78,7 @@ module OutputMode
|
|
74
78
|
output_callables.reject(&:verbose?)
|
75
79
|
end
|
76
80
|
|
77
|
-
if interactive
|
81
|
+
if interactive
|
78
82
|
# Creates the human readable output
|
79
83
|
opts = if ascii
|
80
84
|
{ yes: 'yes', no: 'no', renderer: :ascii }
|
@@ -65,8 +65,12 @@ module OutputMode
|
|
65
65
|
#
|
66
66
|
# An interative/ non-interactive output can be forced by setting the
|
67
67
|
# +interactive+ flag to +true+/+false+ respectively
|
68
|
-
def build_output(verbose:
|
69
|
-
|
68
|
+
def build_output(verbose: nil, ascii: false, interactive: nil, template: nil)
|
69
|
+
# Set the interactive and verbose flags if not provided
|
70
|
+
interactive = $stdout.tty? if interactive.nil?
|
71
|
+
verbose = !interactive if verbose.nil?
|
72
|
+
|
73
|
+
callables = if verbose
|
70
74
|
# Filter out columns that are explicitly not verbose
|
71
75
|
output_callables.select { |o| o.verbose?(true) }
|
72
76
|
else
|
@@ -74,7 +78,7 @@ module OutputMode
|
|
74
78
|
output_callables.reject(&:verbose?)
|
75
79
|
end
|
76
80
|
|
77
|
-
if interactive
|
81
|
+
if interactive
|
78
82
|
# Creates the human readable output
|
79
83
|
opts = if ascii
|
80
84
|
{ yes: 'yes', no: 'no', colorize: false }
|
data/lib/output_mode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: output_mode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William McCumsite
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-table
|