cmdparse 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +20 -0
- data/VERSION +1 -1
- data/doc/src/index.page +8 -0
- data/lib/cmdparse.rb +15 -5
- metadata +2 -2
data/ChangeLog
CHANGED
@@ -1,4 +1,24 @@
|
|
1
1
|
------------------------------------------------------------------------
|
2
|
+
r302 | thomas | 2005-06-16 12:02:37 +0200 (Thu, 16 Jun 2005) | 1 line
|
3
|
+
Changed paths:
|
4
|
+
M /trunk/cmdparse/doc/src/index.page
|
5
|
+
|
6
|
+
* updated index.page
|
7
|
+
------------------------------------------------------------------------
|
8
|
+
r298 | thomas | 2005-06-14 11:31:47 +0200 (Tue, 14 Jun 2005) | 1 line
|
9
|
+
Changed paths:
|
10
|
+
M /trunk/cmdparse/doc/src/index.page
|
11
|
+
|
12
|
+
* updated docu
|
13
|
+
------------------------------------------------------------------------
|
14
|
+
r297 | thomas | 2005-06-14 11:30:22 +0200 (Tue, 14 Jun 2005) | 3 lines
|
15
|
+
Changed paths:
|
16
|
+
M /trunk/cmdparse/lib/cmdparse.rb
|
17
|
+
|
18
|
+
* bumped version number to 1.0.4
|
19
|
+
* bug fix for older ruby versions
|
20
|
+
* fixed bug: OptionParser::ParseError not caught when command executed
|
21
|
+
------------------------------------------------------------------------
|
2
22
|
r291 | thomas | 2005-06-09 12:24:24 +0200 (Thu, 09 Jun 2005) | 1 line
|
3
23
|
Changed paths:
|
4
24
|
M /trunk/cmdparse/doc/src/index.page
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/doc/src/index.page
CHANGED
@@ -12,6 +12,14 @@ Have a look around the site!
|
|
12
12
|
|
13
13
|
h2. News
|
14
14
|
|
15
|
+
<b>2005-06-16 cmdparse 1.0.4 released!!!</b>
|
16
|
+
|
17
|
+
Changes:
|
18
|
+
|
19
|
+
* fix for older ruby versions
|
20
|
+
* fixed bug where exception was not caught
|
21
|
+
|
22
|
+
|
15
23
|
<b>2005-06-09 cmdparse 1.0.3 released!!!</b>
|
16
24
|
|
17
25
|
Changes:
|
data/lib/cmdparse.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
#--
|
3
3
|
#
|
4
|
-
# $Id: cmdparse.rb
|
4
|
+
# $Id: cmdparse.rb 297 2005-06-14 09:30:22Z thomas $
|
5
5
|
#
|
6
6
|
# cmdparse: an advanced command line parser using optparse which supports commands
|
7
7
|
# Copyright (C) 2004 Thomas Leitner
|
@@ -27,8 +27,13 @@ require 'optparse'
|
|
27
27
|
# Some extension to the standard option parser class
|
28
28
|
class OptionParser
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
if const_defined?( 'Officious' )
|
31
|
+
Officious.delete( 'version' )
|
32
|
+
Officious.delete( 'help' )
|
33
|
+
else
|
34
|
+
DefaultList.long.delete( 'version' )
|
35
|
+
DefaultList.long.delete( 'help' )
|
36
|
+
end
|
32
37
|
|
33
38
|
# Returns the <tt>@banner</tt> value. Needed because the method <tt>OptionParser#banner</tt> does
|
34
39
|
# not return the internal value of <tt>@banner</tt> but a modified one.
|
@@ -102,7 +107,7 @@ end
|
|
102
107
|
class CommandParser
|
103
108
|
|
104
109
|
# The version of the command parser
|
105
|
-
VERSION = [1, 0,
|
110
|
+
VERSION = [1, 0, 4]
|
106
111
|
|
107
112
|
# This error is thrown when an invalid command is encountered.
|
108
113
|
class InvalidCommandError < OptionParser::ParseError
|
@@ -350,12 +355,17 @@ class CommandParser
|
|
350
355
|
end
|
351
356
|
|
352
357
|
@parsed[:args] = args
|
358
|
+
|
353
359
|
execute if execCommand
|
354
360
|
end
|
355
361
|
|
356
362
|
# Executes the command. The method +CommandParser#parse!+ has to be called before this one!
|
357
363
|
def execute
|
358
|
-
|
364
|
+
begin
|
365
|
+
commands[@parsed[:command]].execute( self, @parsed[:args] ) if @parsed[:command]
|
366
|
+
rescue OptionParser::ParseError => e
|
367
|
+
handle_exception( e, :local )
|
368
|
+
end
|
359
369
|
end
|
360
370
|
|
361
371
|
private
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.6
|
|
3
3
|
specification_version: 1
|
4
4
|
name: cmdparse
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
7
|
-
date: 2005-06-
|
6
|
+
version: 1.0.4
|
7
|
+
date: 2005-06-16
|
8
8
|
summary: An advanced command line parser using optparse which supports commands
|
9
9
|
require_paths:
|
10
10
|
- lib
|