ordu 0.0.2 → 0.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 (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/ordu.rb +10 -0
  4. data/ordu.gemspec +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 45c704d10811be244289b8d3fb027cd6888725bb
4
- data.tar.gz: 78c7a7d69b655afbf2cd34839d6a22e255c2f6ed
3
+ metadata.gz: 323735146c86f754868b1bb581c06055d6788839
4
+ data.tar.gz: 8a71af7f12a2fac14f974c33c2e180bcb12e93b2
5
5
  SHA512:
6
- metadata.gz: 0b38d6eb9f53b1eb20cbcb70ba9d420db96350f25c2d86f4c712b212d5195969db3c57b9d9c9b52f3973b11466256ed1197b1cc74f7022914a9a20e827ed52b1
7
- data.tar.gz: 5e1d20bd648b9c895c10fcf2f0a4709c12ecad6424c7b15e4a090357815e5d42ef6bec0ebc133c67ae2e82a3959107244952f3a52b88bfdb177f55e882c43f53
6
+ metadata.gz: 04a5ff37e41f840dcd16cde85ec911b5ad8894caf8f6ad7194a13599047fa8cf1ec21ec146051f373db884870d2e98d81a6112a16eb741286ea74fe70d23009b
7
+ data.tar.gz: 2bf31c5b992d75be1f4be7df03ea8d485b3b71566d5d208d03375c29a42f7c790e4d6cb3aaebef94856c3b20f8f2d13da353ebe34a79292db49e11dab85534f8
data/README.md CHANGED
@@ -68,6 +68,9 @@ You can see it in action if you're in this project's directory, and you run
68
68
  examples/sneezer.rb -h
69
69
  examples/sneezer.rb sneeze -h
70
70
 
71
+ These commands print out the Ordús, and thence the options and available
72
+ commands.
73
+
71
74
  ## Development
72
75
 
73
76
  After checking out the repo, run `bin/setup` to install dependencies. Then,
data/lib/ordu.rb CHANGED
@@ -27,6 +27,7 @@ class Ordu < OptionParser
27
27
  action ||= self.class.action
28
28
  options.each { |o| option!(*o) }
29
29
  commands.each { |c| command!(*c) }
30
+ on_tail(command_summary) if command_summary
30
31
  @action = action
31
32
  end
32
33
 
@@ -42,6 +43,15 @@ class Ordu < OptionParser
42
43
  run(*args)
43
44
  end
44
45
 
46
+ # A string which summarizes the commands - shown in the help
47
+ def command_summary
48
+ return if commands.empty?
49
+ w = commands.keys.map(&:length).max
50
+ lines = ["Available commands:"]
51
+ lines += commands.map { |k, v| " %-#{w}s %s" % [k, v.desc] }
52
+ lines.join("\n")
53
+ end
54
+
45
55
  # Parses a new instance. Note that this must be the top-level, since you
46
56
  # can't supply a name. This is convenient for starting the parser from
47
57
  # scripts.
data/ordu.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = 'ordu'
7
- spec.version = '0.0.2'
7
+ spec.version = '0.0.3'
8
8
  spec.authors = ['JJ Buckley']
9
9
  spec.email = ['jj@bjjb.org']
10
10
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - JJ Buckley