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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd65b05c653ffc6f25c973391b1cc49fc866a332
4
- data.tar.gz: 1626dddaf85fa792a31598a30f7b109bf65e8ff9
3
+ metadata.gz: cca558cbc71212156372b50cbbb96f1852a98f52
4
+ data.tar.gz: b7015c7ca8d0b8305f57a7927b85920a8940d27c
5
5
  SHA512:
6
- metadata.gz: d88d1e1c20bed12c969ae7eb8462627c7dd9fdc622ad7a0980b98ea2dd18b45b34fa8b62c2a6699ac5d779e51462d3c1df70da49faa8edc59326874f869a9618
7
- data.tar.gz: a3f9bc313cfb3f0b2d1edeba0e768c4847013cd50b77d55a867f2e0efa7fdc97b98788c1b74bf8ac75a31fac6359cedb311580363c1c678f2989e64adf1913f3
6
+ metadata.gz: 7ac446ec3a52cf37763809cca7a8c1cdcf701023527b6871603568679937a92f8e2e830c1169c29243be0157db30631069f9d2c17c3facb7bcd558b694fd77ec
7
+ data.tar.gz: 4c236b552b914b003e9e40562e3035c21bf727209a0295492cbaf8c560c681e5f7ba84ae1519914bd8652e58fcf113294335717bbf7b823134cbbc6e0f6b2f7b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple-cli (0.1.3)
4
+ simple-cli (0.1.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
- CommandHelp.new(@app, sym).interface(binary_name, string_to_command(sym))
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
@@ -1,5 +1,5 @@
1
1
  module Simple
2
2
  module CLI
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - radiospiel