command-line-utils 0.0.3 → 0.0.6

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.6
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{command-line-utils}
8
- s.version = "0.0.3"
8
+ s.version = "0.0.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Yoshihiro TAKAHARA"]
12
- s.date = %q{2011-02-23}
12
+ s.date = %q{2011-02-25}
13
13
  s.description = %q{This is a command line utilites.}
14
14
  s.email = %q{y.takahara@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,10 @@ module CommandLineUtils
30
30
  @commands.options = @options
31
31
  @commands.command_options = cmd_argv
32
32
  dispatch(cmd,cmd_argv)
33
- rescue =>e
33
+ rescue UsageException => e
34
+ usage
35
+ raise e if @options[:debug]
36
+ rescue => e
34
37
  puts "Message: #{e}"
35
38
  # puts ""
36
39
  # usage unless @options[:debug]
@@ -2,6 +2,7 @@
2
2
  # -*- coding: utf-8 -*-
3
3
  require 'optparse'
4
4
  module CommandLineUtils
5
+ class UsageException < Exception; end
5
6
  class Commands
6
7
  attr_reader :commands
7
8
  attr_accessor :options,:command_options
@@ -21,6 +22,7 @@ module CommandLineUtils
21
22
 
22
23
  @help = true
23
24
  command = @command_options.shift
25
+ raise UsageException unless command
24
26
  raise "Unknown command: " + command unless commands.include?(command)
25
27
  opt = send(command.sub(/:/,"_"))
26
28
  puts "Summery: #{@summery}"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command-line-utils
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Yoshihiro TAKAHARA
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-23 00:00:00 +09:00
18
+ date: 2011-02-25 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency