pause_output 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -2
- data/lib/pause_output/globalize.rb +3 -3
- data/lib/pause_output/output_pager.rb +21 -3
- data/lib/pause_output/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f07a728fb17d8650be3191bc00a3dda19e48d9db
|
4
|
+
data.tar.gz: 2480a692ce205401748633a48b820ec5300e8494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94d81e38f5bf8938d7094081b503d760b2b5964bd1397dec9f9759108671ceeda5503d9f1c5832da6f718a1658b13a32fb39f810a6c4efc019f21812b3d2d255
|
7
|
+
data.tar.gz: d234de7852054060c8529a1d001434aa2df161a4f0cc0e25c0cb9739111c1d31d9647c88b862a20c04dd6c4ad4bde1c4592404814228bf251cd39fcca077c9b7
|
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
|
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
|
-
|
14
|
-
|
13
|
+
enabled = options[:page_pause]
|
14
|
+
enabled = enabled.downcase if enabled.is_a?(String)
|
15
15
|
|
16
|
-
unless [false, 'false', 'off', 'no'].include?(
|
16
|
+
unless [false, 'false', 'off', 'no'].include?(enabled)
|
17
17
|
$stdout = ::PauseOutput::OutputPager.new(options) if outer
|
18
18
|
end
|
19
19
|
|
@@ -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
|
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] :
|
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
|
data/lib/pause_output/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pause_output
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PeterCamilleri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|