pause_output 0.1.1 → 0.2.3

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
- SHA1:
3
- metadata.gz: 5342f9d87af606805365df2af5c446efca66ba75
4
- data.tar.gz: 6b1f9b15f87fd1c025a74c72e152a9abe3db487a
2
+ SHA256:
3
+ metadata.gz: 14243b22505eac025088448e37ef3ac9923c412dc0565548fdafa55742fa8628
4
+ data.tar.gz: c7e9a90ed552241ee705dd25e77a94161e8888028e8dbbab2c104d462a8f9e46
5
5
  SHA512:
6
- metadata.gz: daf91ec8df41fc794ef1771f9bb144ed9edd1c1e9bbba18f8ac7c714c836c494144b825bf500346566af525ec4f2dc091aab5088fbdb6f50555336c2fdba907d
7
- data.tar.gz: 16c3baf9839ed3cf8538a613a16cd4ea34d10cae13fd9ecf599f0dc5fb60faab2b24f14a1d64ec7d5224ce8e6261cb8dbfb5a75222413768be17834d89beda8c
6
+ metadata.gz: b3e22ccbf86b0f1bdf768d1671cb1e220a73b553094b4dadbc2b3f55029a14e2ead1dc8285acd947fc69be60f818a43a10d9c1147719f02237a8720c56c35d85
7
+ data.tar.gz: 5961570ca4cf56b8034f1fc987278ec90c43278601d43255d402c393169e2810f401dec181d5af0f9a3bc48d55a025328a1ede4dd774246c6b577a74adf1913e
data/README.md CHANGED
@@ -50,14 +50,19 @@ Option | Values | Default | Description
50
50
  :page_pause | boolean | true | Is page pause enabled?
51
51
  :page_height| integer | console height| The height of the page.
52
52
  :page_width | integer | console width | The width of the page.
53
- :page_msg | string | "Press enter, space or q:" | The paused prompt message.
53
+ :page_msg | string | "Press space (line), n (no pause), q(uit) or other (page):" | The paused prompt message.
54
+ :one_line | string | " " | The key to progress by one line.
55
+ :skip_all | string | "q" | The key to skip the rest of the output.
56
+ :no_pause | string | "n" | The key to display the rest with no pauses.
54
57
 
55
58
  The default value is used if the option is absent from the hash. Unsupported
56
59
  option values are ignored and have no effect.
57
60
 
58
61
  Notes:
62
+
59
63
  * Setting page_pause to false can allow a block of code to run without pausing
60
- at page breaks, if that is desired.
64
+ at page breaks, if that is desired. Since, Ruby has no boolean type, this can
65
+ be any object. The values false, "false", "off", or "no" will disable pauses.
61
66
  * If the :page_height and :page_width values are not valid, the default values
62
67
  will be used instead.
63
68
  * Nesting of "more" blocks is allowed. However, only the options of the outermost
@@ -10,10 +10,10 @@ class Object
10
10
  saved = $stdout
11
11
  outer = $stdout.equal?($pause_output_out)
12
12
 
13
- disabled = options[:page_pause]
14
- disabled = disabled.downcase if disabled.is_a?(String)
13
+ enabled = options[:page_pause]
14
+ enabled = enabled.downcase if enabled.is_a?(String)
15
15
 
16
- unless [false, 'false', 'off', 'no'].include?(disabled)
16
+ unless [false, 'false', 'off', 'no'].include?(enabled)
17
17
  $stdout = ::PauseOutput::OutputPager.new(options) if outer
18
18
  end
19
19
 
@@ -16,7 +16,7 @@ module PauseOutput
16
16
 
17
17
  # Write out a general string with page pauses.
18
18
  def write(str)
19
- while !str.empty?
19
+ until str.empty?
20
20
  pre,mid,str = str.partition("\n")
21
21
  write_str(pre) unless pre.empty?
22
22
  writeln unless mid.empty?
@@ -62,11 +62,13 @@ module PauseOutput
62
62
 
63
63
  if @lines >= (lines_per_page - 1)
64
64
  case pause.downcase
65
- when " "
65
+ when one_line
66
66
  @lines -= 1
67
- when "q"
67
+ when skip_all
68
68
  @lines = 0
69
69
  raise PauseOutputStop
70
+ when no_pause
71
+ @lines = -1_000_000
70
72
  else
71
73
  @lines = 0
72
74
  end
@@ -104,7 +106,23 @@ module PauseOutput
104
106
 
105
107
  # Get the text of the pause message.
106
108
  def pause_message
107
- @options.key?(:page_msg) ? @options[:page_msg] : "Press enter, space or q:"
109
+ @options.key?(:page_msg) ? @options[:page_msg] :
110
+ "Press space (line), n (no pause), q(uit) or other (page):"
111
+ end
112
+
113
+ # Keystroke to advance one line.
114
+ def one_line
115
+ @options.key?(:one_line) ? @options[:one_line] : " "
116
+ end
117
+
118
+ # Keystroke to quit processing.
119
+ def skip_all
120
+ @options.key?(:skip_all) ? @options[:skip_all] : "q"
121
+ end
122
+
123
+ # Keystroke to disable pauses.
124
+ def no_pause
125
+ @options.key?(:no_pause) ? @options[:no_pause] : "n"
108
126
  end
109
127
 
110
128
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  # Pause console output so that it can be read before scrolling off the screen.
4
4
  module PauseOutput
5
- VERSION = "0.1.1".freeze
5
+ VERSION = "0.2.3".freeze
6
6
 
7
7
  DESCRIPTION = "pause_output: A simple facility to pause output on the console terminal.".freeze
8
8
  end
data/pause_output.gemspec CHANGED
@@ -23,10 +23,9 @@ Gem::Specification.new do |spec|
23
23
  .grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.17"
27
- spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "bundler", ">= 2.1.0"
27
+ spec.add_development_dependency "rake", ">= 12.3.3"
28
28
  spec.add_development_dependency "minitest", "~> 5.0"
29
- spec.add_development_dependency 'minitest_visible', "~> 0.1"
30
29
  spec.add_development_dependency 'reek', "~> 5.0.2"
31
30
 
32
31
  spec.add_runtime_dependency 'mini_term', "~> 0.1.0"
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pause_output
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - PeterCamilleri
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-07 00:00:00.000000000 Z
11
+ date: 2021-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.17'
19
+ version: 2.1.0
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.17'
26
+ version: 2.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
- - !ruby/object:Gem::Dependency
56
- name: minitest_visible
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '0.1'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '0.1'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: reek
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -134,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
120
  - !ruby/object:Gem::Version
135
121
  version: '0'
136
122
  requirements: []
137
- rubyforge_project:
138
- rubygems_version: 2.5.2
123
+ rubygems_version: 3.2.17
139
124
  signing_key:
140
125
  specification_version: 4
141
126
  summary: Pause lengthy console output.