pocketwatch 0.1.0 → 0.1.1
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/Gemfile.lock +1 -1
- data/README.md +5 -1
- data/lib/pocketwatch.rb +1 -1
- data/lib/pocketwatch/version.rb +1 -1
- data/lib/pocketwatch/watcher.rb +6 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9226e5de85c599f936431e8671977225c9c9551bf3a296a91e34f0d6343ea37e
|
4
|
+
data.tar.gz: 47be2034eec10a51414bcdf52ffdef75bb002a16476d3370a3f4ac7292aa3890
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0d9bc5898efff01153331ae48d812864eeb8bc3c7cf06e3d7ae8e9c1aa621788115698236668c053356dab069cfc5c10dfea944612f7078bb040c3b20537bba
|
7
|
+
data.tar.gz: 3bf4f180e5bc48b625e1e2a0c63d3233e4ed8c10615e7d8c2ca67c1f0b77727f484e2f5dbfc21609482c40370901b70c2d068d7fde343f2ab9d10246635e9409
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,7 +12,11 @@ gem install pocketwatch
|
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
15
|
-
|
15
|
+
```
|
16
|
+
Usage: pocketwatch [options] -- <command>
|
17
|
+
-v, --version Print the version number
|
18
|
+
-n INTERVAL Length in seconds between command execution
|
19
|
+
```
|
16
20
|
|
17
21
|
## License
|
18
22
|
|
data/lib/pocketwatch.rb
CHANGED
@@ -29,7 +29,7 @@ module Pocketwatch
|
|
29
29
|
exit
|
30
30
|
end
|
31
31
|
|
32
|
-
opts.on("-n INTERVAL", Integer, "
|
32
|
+
opts.on("-n INTERVAL", Integer, "Length in seconds between command execution") do |v|
|
33
33
|
unless v.positive?
|
34
34
|
warn "Must provide a positive integer for the command execution interval."
|
35
35
|
exit
|
data/lib/pocketwatch/version.rb
CHANGED
data/lib/pocketwatch/watcher.rb
CHANGED
@@ -29,8 +29,12 @@ module Pocketwatch
|
|
29
29
|
# Double buffer the output by precomputing the results of the system
|
30
30
|
# call. Then, clear the terminal and print the results as quickly as
|
31
31
|
# possible - this should avoid any flickering due to clearing the
|
32
|
-
# terminal.
|
33
|
-
|
32
|
+
# terminal. Restrict the output of the command to the current height of
|
33
|
+
# the terminal - scrolling is not supported, and we want to see the
|
34
|
+
# first part of the output, not the last.
|
35
|
+
num_lines = `tput lines`.strip.to_i - 1
|
36
|
+
num_lines = 1 unless num_lines.positive?
|
37
|
+
output = `#{@command}`.split("\n").first(num_lines)
|
34
38
|
|
35
39
|
clear_screen
|
36
40
|
puts output
|