bkmrq 0.0.4 → 0.0.5
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/lib/bkmrq/cli.rb +15 -3
- 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: 4ee67957af96bba18676779fe6cb3c818374720d6401483e3b5ff24a760a421b
|
4
|
+
data.tar.gz: 312c79e8cf2beb187bebcb1405bcb0e157d867a1fe07cfe4a37745a82920641a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59cbd60d25856f3c89df44f84efe7f60c3faa3039dfebcca54f8f9865c848fddfd05f0f48bc0ecbd7a9276d4ea23dd2ee82b4a056618bf7d370cda3361800a0c
|
7
|
+
data.tar.gz: 91a1b4abaffe181f5af152b26b33a832cbdd364d5bca2f03e2e11b10ae4e4bfd2d9b7d02f4da52bda4ae4fa3e4215342ee5f7951b8687a7049e94f52aada3b48
|
data/lib/bkmrq/cli.rb
CHANGED
@@ -11,14 +11,18 @@ module Bkmrq
|
|
11
11
|
class Cli
|
12
12
|
def initialize(args)
|
13
13
|
@opts = {}
|
14
|
-
option_parser.parse!(sanitize_args(args), into: @opts)
|
14
|
+
option_parser.parse!(default_args(sanitize_args(args)), into: @opts)
|
15
|
+
init_app if opts_valid?
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def init_app
|
15
21
|
Bkmrq::App.new(
|
16
22
|
**@opts.slice(*Bkmrq::Manual.options_specs.map(&:last))
|
17
23
|
).export!
|
18
24
|
end
|
19
25
|
|
20
|
-
private
|
21
|
-
|
22
26
|
def option_parser
|
23
27
|
@option_parser ||= OptionParser.new do |args|
|
24
28
|
# Option Parsing
|
@@ -36,5 +40,13 @@ module Bkmrq
|
|
36
40
|
def sanitize_args(args)
|
37
41
|
args.reject(&:empty?).map(&:scrub).map(&:split).flatten
|
38
42
|
end
|
43
|
+
|
44
|
+
def default_args(args)
|
45
|
+
args.empty? ? ['-H'] : args
|
46
|
+
end
|
47
|
+
|
48
|
+
def opts_valid?
|
49
|
+
!@opts.key?(:help)
|
50
|
+
end
|
39
51
|
end
|
40
52
|
end
|