lapidarius 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lapidarius/cli.rb +31 -3
- data/lib/lapidarius/version.rb +1 -1
- 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: 662c7f9cb912bbd9b30b03badf183aaf24fd437c4344a2fc3a0834880de5ee27
|
4
|
+
data.tar.gz: 7187b0b9f13dae1d38851f1563e326e8a67b705c5f23bd5011f6ad141e4037f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1789815ca25aa747d7c628ba444331e84e60055689ad03e97d9df883c14e30b85fb0225efb97066634323c3c411369ab28650ee2bd0f48438c6df975d855dc40
|
7
|
+
data.tar.gz: 333c63d14cfff43d1b9967c6bcabf9e52b462f17aeec55a4c2c44dad43a4616899844bd0c41a0028dbe1d5a43f96fe58d7cc398bc839ad07b44208b9a5feb714
|
data/lib/lapidarius/cli.rb
CHANGED
@@ -7,18 +7,22 @@ module Lapidarius
|
|
7
7
|
|
8
8
|
attr_reader :name, :version, :remote
|
9
9
|
|
10
|
-
def initialize(args: [], io: STDOUT, command: Command, cutter: Cutter,
|
10
|
+
def initialize(args: [], io: STDOUT, command: Command, cutter: Cutter,
|
11
|
+
tree: Tree, spinner: Spinner.new)
|
11
12
|
@args = args
|
12
13
|
@io = io
|
13
|
-
@tree = tree
|
14
14
|
@command = command
|
15
15
|
@cutter = cutter
|
16
|
+
@tree = tree
|
17
|
+
@spinner = spinner
|
16
18
|
@name = @args.shift unless help?
|
17
19
|
parser.parse!(@args)
|
18
20
|
end
|
19
21
|
|
20
22
|
def call
|
21
|
-
@
|
23
|
+
@spinner.call do
|
24
|
+
@io.puts output
|
25
|
+
end
|
22
26
|
end
|
23
27
|
|
24
28
|
private def cutter
|
@@ -56,4 +60,28 @@ module Lapidarius
|
|
56
60
|
HELP_FLAGS.any? { |h| @args.first == h }
|
57
61
|
end
|
58
62
|
end
|
63
|
+
|
64
|
+
class Spinner
|
65
|
+
CHARS = %w[| / - \\]
|
66
|
+
|
67
|
+
def initialize(fps = 15, delay = 1.0)
|
68
|
+
@fps = fps.to_i
|
69
|
+
@delay = delay.to_f / @fps
|
70
|
+
@iter = 0
|
71
|
+
end
|
72
|
+
|
73
|
+
def call
|
74
|
+
spinner = Thread.new do
|
75
|
+
while @iter do
|
76
|
+
print CHARS[(@iter+=1) % CHARS.length]
|
77
|
+
sleep @delay
|
78
|
+
print "\b"
|
79
|
+
end
|
80
|
+
end
|
81
|
+
yield.tap do
|
82
|
+
@iter = false
|
83
|
+
spinner.join
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
59
87
|
end
|
data/lib/lapidarius/version.rb
CHANGED