subcommander 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. data/lib/subcommander.rb +6 -2
  2. metadata +4 -4
@@ -40,7 +40,11 @@ module Subcommander
40
40
  end
41
41
 
42
42
  def print_usage
43
- puts "\n#{@desc}\n\n"
43
+ desc = @desc
44
+ if @desc.kind_of?(Proc)
45
+ desc = @desc.call().rstrip
46
+ end
47
+ puts "\n#{desc}\n\n"
44
48
  puts " Subcommands:"
45
49
  @file_order.each do |cmd|
46
50
  puts " #{slop(cmd)} #{@commands[cmd].desc}"
@@ -137,7 +141,7 @@ module Subcommander
137
141
  def subcommand name, desc, &block
138
142
  unless @sub_cmdr
139
143
  @sub_cmdr = Subcommander.new(@args.clone())
140
- @sub_cmdr.desc = " The #{@name} subcommand has the following subcommands:"
144
+ @sub_cmdr.desc = lambda { @help }
141
145
  end
142
146
  @sub_cmdr.subcommand(name, desc, &block)
143
147
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: subcommander
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 2
10
- version: 1.0.2
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tom Santos
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-16 00:00:00 -07:00
18
+ date: 2011-05-17 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies: []
21
21