git-wayback-machine 0.1.1 → 0.1.2
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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff567727fc7b31ce89797333e5720de1a8c03c7
|
4
|
+
data.tar.gz: 6c9e361467df8be857437786d338c628490204c9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: edc453f42ab71cb372747e3b11aa0ca04be28eebcceef00595b5ca416bafa1132da4c915c09fcd9ade05b91253113d079f29c1290cc6914f63d9e0f725005888
|
7
|
+
data.tar.gz: 0544baf52a36270e4ffbcbb4511ebeb06ef2e59306f1624099d96fc20779b61efd8318bb373c7b5f793f5ed981a3798ba852618b53975bc62fe89e3e803d25d1
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "io/console"
|
2
|
+
|
1
3
|
module GitWaybackMachine
|
2
4
|
|
3
5
|
class Controls
|
@@ -20,25 +22,20 @@ module GitWaybackMachine
|
|
20
22
|
private
|
21
23
|
|
22
24
|
def read_key
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
STDIN.raw do |io|
|
26
|
+
key = io.getc.chr
|
27
|
+
|
28
|
+
if key == "\e"
|
29
|
+
extra_thread = Thread.new do
|
30
|
+
key += io.getc.chr + io.getc.chr
|
31
|
+
end
|
32
|
+
extra_thread.join(0.001)
|
33
|
+
extra_thread.kill
|
31
34
|
end
|
32
|
-
extra_thread.join(0.001)
|
33
|
-
extra_thread.kill
|
34
|
-
end
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
ensure
|
39
|
-
`stty #{old_state}`
|
36
|
+
key
|
37
|
+
end
|
40
38
|
end
|
41
|
-
|
42
39
|
end
|
43
40
|
|
44
41
|
end
|
@@ -9,7 +9,13 @@ module GitWaybackMachine
|
|
9
9
|
|
10
10
|
class Entry < Struct.new(:sha, :name, :time, :comment)
|
11
11
|
def to_s
|
12
|
-
"\e[33m#{sha}\e[37m | \e[35m#{name} \e[36m(#{time})\e[37m -
|
12
|
+
meta = "\e[33m#{sha}\e[37m | \e[35m#{name.ljust(17)} \e[36m(#{time})\e[37m - "
|
13
|
+
size_so_far = meta.gsub(/\e\[\d+m/, "").size
|
14
|
+
terminal_width = `tput cols`.to_i
|
15
|
+
cut_comment = comment.slice(0, terminal_width - size_so_far - 3)
|
16
|
+
cut_comment << "…" if comment.size > cut_comment.size
|
17
|
+
|
18
|
+
"#{meta}#{cut_comment}\e[0m"
|
13
19
|
end
|
14
20
|
end
|
15
21
|
|
@@ -41,8 +41,9 @@ module GitWaybackMachine
|
|
41
41
|
|
42
42
|
def cleanup
|
43
43
|
navigator_size = entries_slice.size + 2
|
44
|
+
terminal_size = `tput cols`.to_i
|
44
45
|
print "\r\e[#{navigator_size}A"
|
45
|
-
print (" " *
|
46
|
+
print (" " * terminal_size + "\n") * navigator_size
|
46
47
|
print "\r\e[#{navigator_size}A"
|
47
48
|
end
|
48
49
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-wayback-machine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikolay Nemshilov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|