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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: aba3d3f1c1ef5bd16dc8397b9500218ccc652af7dc6c11d85dfbb16cd7ec0ee0
4
- data.tar.gz: 9568bee91c9a89576fa24a97e8d0fba2cbf86f28fb4d2f6ede3093b773bade17
3
+ metadata.gz: 2ad0728b37cf092a7e009021655552acae2f4493b66bafa17509efc0e0740435
4
+ data.tar.gz: 96875c08fa06eb7b868e7d4069965d6704e75ac126917fba5fb7e0f78cf4ff2e
5
5
  SHA512:
6
- metadata.gz: 409dc9ad72f0a1771ad325995905bde702dcae4d3839b983c7cf02a5ace8927ef9cecc70954666dbce3a634b144d0ee8e8bf3f7981a55edcc52c480545ce36eb
7
- data.tar.gz: 8663a174778b268e3ea596a81856ff2f53b3a4d3387e68e329bddb38f6d3e002bfc8838d3634304a7680cf8a998db99468dc18b210356259522b1c69aea34d00
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: false, ascii: false, interactive: nil, header_color: [:blue, :bold], row_color: :green)
69
- callables = if verbose || !$stdout.tty?
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 || (interactive.nil? && $stdout.tty?)
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: false, ascii: false, interactive: nil, template: nil)
69
- callables = if verbose || !$stdout.tty?
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 || (interactive.nil? && $stdout.tty?)
81
+ if interactive
78
82
  # Creates the human readable output
79
83
  opts = if ascii
80
84
  { yes: 'yes', no: 'no', colorize: false }
@@ -25,5 +25,5 @@
25
25
  #==============================================================================
26
26
 
27
27
  module OutputMode
28
- VERSION = "1.3.0"
28
+ VERSION = "1.4.0"
29
29
  end
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.3.0
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-04 00:00:00.000000000 Z
11
+ date: 2020-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-table