simple-cli 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/simple/cli/runner.rb +3 -2
- data/lib/simple/cli/runner/autocompletion.rb +1 -1
- data/lib/simple/cli/runner/command_help.rb +6 -2
- data/lib/simple/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cca558cbc71212156372b50cbbb96f1852a98f52
|
4
|
+
data.tar.gz: b7015c7ca8d0b8305f57a7927b85920a8940d27c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ac446ec3a52cf37763809cca7a8c1cdcf701023527b6871603568679937a92f8e2e830c1169c29243be0157db30631069f9d2c17c3facb7bcd558b694fd77ec
|
7
|
+
data.tar.gz: 4c236b552b914b003e9e40562e3035c21bf727209a0295492cbaf8c560c681e5f7ba84ae1519914bd8652e58fcf113294335717bbf7b823134cbbc6e0f6b2f7b
|
data/Gemfile.lock
CHANGED
data/lib/simple/cli/runner.rb
CHANGED
@@ -114,7 +114,7 @@ class Simple::CLI::Runner
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def string_to_command(s)
|
117
|
-
s.tr(":", "_").to_sym
|
117
|
+
s.to_s.tr(":", "_").to_sym
|
118
118
|
end
|
119
119
|
|
120
120
|
def commands
|
@@ -127,7 +127,8 @@ class Simple::CLI::Runner
|
|
127
127
|
return
|
128
128
|
end
|
129
129
|
|
130
|
-
|
130
|
+
cmd = string_to_command(sym)
|
131
|
+
CommandHelp.new(@app, cmd).interface(binary_name, cmd)
|
131
132
|
end
|
132
133
|
|
133
134
|
def binary_name
|
@@ -32,7 +32,7 @@ module Simple::CLI::Runner::Autocompletion
|
|
32
32
|
|
33
33
|
def autocomplete_subcommand_options(subcommand, cur)
|
34
34
|
completions = if subcommand == "help"
|
35
|
-
commands.map(&:to_s) + ["autocomplete"]
|
35
|
+
commands.map(&:to_s).map { |s| s.tr("_", ":") } + ["autocomplete"]
|
36
36
|
else
|
37
37
|
CommandHelp.option_names(@app, string_to_command(subcommand))
|
38
38
|
end
|
@@ -10,7 +10,7 @@ class Simple::CLI::Runner::CommandHelp
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def initialize(mod, method)
|
13
|
-
raise(ArgumentError) unless method.is_a?(Symbol)
|
13
|
+
raise(ArgumentError, "#{method.inspect} should be a Symbol") unless method.is_a?(Symbol)
|
14
14
|
@mod = mod
|
15
15
|
@method = method
|
16
16
|
end
|
@@ -57,7 +57,7 @@ class Simple::CLI::Runner::CommandHelp
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
help = "#{binary_name} #{command_name}"
|
60
|
+
help = "#{binary_name} #{command_to_string(command_name)}"
|
61
61
|
help << " #{options.join(' ')}" unless options.empty?
|
62
62
|
help << " #{args.join(' ')}" unless args.empty?
|
63
63
|
help
|
@@ -65,6 +65,10 @@ class Simple::CLI::Runner::CommandHelp
|
|
65
65
|
|
66
66
|
private
|
67
67
|
|
68
|
+
def command_to_string(s)
|
69
|
+
s.to_s.tr("_", ":")
|
70
|
+
end
|
71
|
+
|
68
72
|
def comments
|
69
73
|
@comments ||= begin
|
70
74
|
file, line = @mod.instance_method(@method).source_location
|
data/lib/simple/cli/version.rb
CHANGED