mothership 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,17 +10,21 @@ class Mothership
10
10
  end
11
11
 
12
12
  def given?(name)
13
- @given.key?(name)
13
+ @inputs.key?(name) || @given.key?(name)
14
14
  end
15
15
 
16
16
  def given(name)
17
- @given[name]
17
+ @inputs[name] || @given[name]
18
18
  end
19
19
 
20
20
  def merge(inputs)
21
21
  self.class.new(@command, @context, @given, @inputs.merge(inputs))
22
22
  end
23
23
 
24
+ def merge_given(inputs)
25
+ self.class.new(@command, @context, @given.merge(inputs), @inputs)
26
+ end
27
+
24
28
  def without(*names)
25
29
  given = @given.dup
26
30
  inputs = @inputs.dup
@@ -46,6 +50,7 @@ class Mothership
46
50
  return @inputs[name] = [@inputs[singular]] if @inputs.key?(singular)
47
51
 
48
52
  given = @given[name] if @given.key?(name)
53
+ given ||= [@given[singular]] if @given.key?(singular)
49
54
 
50
55
  # value given; convert if needed
51
56
  if given && given != []
@@ -25,7 +25,7 @@ class Mothership
25
25
  unless name
26
26
  # assume first argument is subcommand
27
27
  if args.empty? && find_in && !local
28
- local = find_in[flag.to_sym]
28
+ local = find_in[flag.gsub("-", "_").to_sym]
29
29
  end
30
30
 
31
31
  args << flag
@@ -71,12 +71,15 @@ module Mothership::Pretty
71
71
 
72
72
  return str unless color
73
73
 
74
- "\e[#{bright ? 9 : 3}#{COLOR_CODES[color]}m#{str}\e[0m"
74
+ code = "\e[#{bright ? 9 : 3}#{COLOR_CODES[color]}m"
75
+ "#{code}#{str.gsub("\e[0m", "\e[0m#{code}")}\e[0m"
75
76
  end
76
77
 
77
78
  # bold text
78
79
  def b(str)
79
80
  return str unless color?
80
- "\e[1m#{str}\e[0m"
81
+
82
+ code = "\e[1m"
83
+ "#{code}#{str.gsub("\e[0m", "\e[0m#{code}")}\e[0m"
81
84
  end
82
85
  end
@@ -1,3 +1,3 @@
1
1
  class Mothership
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mothership
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 9
10
- version: 0.0.9
9
+ - 10
10
+ version: 0.0.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Suraci
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-07-19 00:00:00 Z
18
+ date: 2012-07-23 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rake