cksh_commander 0.2.0 → 0.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fc237603bb3d1579fcf9ae3700e17207a2e2f901
4
- data.tar.gz: 7a77d47f54af6d498763704a43c8f53a304e0c65
3
+ metadata.gz: 25be78fc47c94ddecfec773202ec0a40affdc40d
4
+ data.tar.gz: 1d2d18a2cd6856cffcdabdd9d531ba7cdcdec109
5
5
  SHA512:
6
- metadata.gz: 72540f0185bff479bed0aa697be2c02ab9b445e0dd948ac5edf23f9cfb00daec314eab88f79a1dfc2c1694dcc309f7095c677a3066c7cd98088cd77c7d10657e
7
- data.tar.gz: a6848cad5216d2afacec0feeb90dd6e0952d56d54920c11126e773d1751d4ef0ec4c8af1081dbba8c338ec698d1d0ee9dfb6b50246580f4de65e9d0486a2d427
6
+ metadata.gz: f67bbb6ccf941cd8188fb83da89a89fe7eb55d81adcd90cf9de12b0a9fcd2ed0bcdfe90f91861b9b347dfea7b088c755675152147af55a30e9589338adc7d068
7
+ data.tar.gz: 1a0f136ad3651a93d6c469e576469c89e164a726dad83450200f84a4d77ae5791d9583cfa4cc3d6097fbf00a3c18e55e6dc7fcd0fe72fde1b73f2ed898c43a86
@@ -46,7 +46,7 @@ module CKSHCommander
46
46
  # method and its arity. Represent the original subcommand string.
47
47
  subcommand = matched_subcommands.max_by(&:size).to_s
48
48
  subcommand_m = method(subcommand)
49
- subcommand_a = subcommand_m.arity
49
+ subcommand_a = subcommand_m.arity.abs
50
50
  subcommand_o = subcommand.gsub(/_/, ' ')
51
51
 
52
52
  # Get argument string and slurp up arguments using arity. We
@@ -54,10 +54,10 @@ module CKSHCommander
54
54
  argstr, args = @data.text.gsub(subcommand_o, '').strip, []
55
55
  subcommand_a.times do |i|
56
56
  if i + 1 == subcommand_a
57
- args << argstr
57
+ args << (argstr.empty? ? nil : argstr)
58
58
  else
59
59
  arg = argstr.split(' ')[0]
60
- argstr.gsub!(Regexp.new("\\A#{arg} "), '')
60
+ argstr.gsub!(Regexp.new("\\A#{arg}\s?"), '')
61
61
  args << arg
62
62
  end
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module CKSHCommander
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cksh_commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Loncar
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-10 00:00:00.000000000 Z
11
+ date: 2015-12-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler