trollop 1.14 → 1.15

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 1.15 / 2009-09-30
2
+ * Don't raise an exception when out of short arguments (thanks to Rafael
3
+ Sevilla for pointing out how dumb this behavior was).
4
+
1
5
  == 1.14 / 2009-06-19
2
6
  * Make :multi arguments default to [], not nil, when not set on the commandline.
3
7
  * Minor commenting and error message improvements
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  == trollop
2
2
 
3
- by William Morgan (wmorgan-trollop at the masanjin dot nets or http://cs.stanford.edu/~ruby)
3
+ by William Morgan (http://masanjin.net/)
4
4
 
5
5
  Main page: http://trollop.rubyforge.org
6
6
 
@@ -8,21 +8,22 @@ Release announcements and comments: http://all-thing.net/search/label/trollop
8
8
 
9
9
  Documentation quickstart: See Trollop::options (for some reason rdoc isn't
10
10
  linking that; it's in the top right of the screen if you're browsing online)
11
- and then Trollop::Parser#opt. Also see the examples at http://trollop.rubyforge.org/.
11
+ and then Trollop::Parser#opt. Also see the examples at
12
+ http://trollop.rubyforge.org/.
12
13
 
13
14
  == DESCRIPTION
14
15
 
15
16
  Trollop is a commandline option parser for Ruby that just gets out of your
16
- way. One line of code per option is all you need to write. For that, you get
17
- a nice automatically-generated help page, robust option parsing, command
17
+ way. One line of code per option is all you need to write. For that, you get a
18
+ nice automatically-generated help page, robust option parsing, command
18
19
  subcompletion, and sensible defaults for everything you don't specify.
19
20
 
20
21
  == FEATURES/PROBLEMS
21
22
 
22
23
  - Dirt-simple usage.
23
24
  - Sensible defaults. No tweaking necessary, much tweaking possible.
24
- - Support for long options, short options, short option bundling,
25
- and automatic type validation and conversion.
25
+ - Support for long options, short options, short option bundling, and
26
+ automatic type validation and conversion.
26
27
  - Support for subcommands.
27
28
  - Automatic help message generation, wrapped to current screen width.
28
29
  - Lots of unit tests.
@@ -37,4 +38,5 @@ subcompletion, and sensible defaults for everything you don't specify.
37
38
 
38
39
  == LICENSE
39
40
 
40
- Copyright (c) 2008 William Morgan. Trollop is distributed under the same terms as Ruby.
41
+ Copyright (c) 2008--2009 William Morgan. Trollop is distributed under the same
42
+ terms as Ruby.
@@ -7,7 +7,7 @@ require 'date'
7
7
 
8
8
  module Trollop
9
9
 
10
- VERSION = "1.14"
10
+ VERSION = "1.15"
11
11
 
12
12
  ## Thrown by Parser in the event of a commandline error. Not needed if
13
13
  ## you're using the Trollop::options entry.
@@ -614,10 +614,10 @@ private
614
614
  next if opts[:short]
615
615
 
616
616
  c = opts[:long].split(//).find { |d| d !~ INVALID_SHORT_ARG_REGEX && !@short.member?(d) }
617
- raise ArgumentError, "can't generate a default short option name for #{opts[:long].inspect}: out of unique characters" unless c
618
-
619
- opts[:short] = c
620
- @short[c] = name
617
+ if c # found a character to use
618
+ opts[:short] = c
619
+ @short[c] = name
620
+ end
621
621
  end
622
622
  end
623
623
 
@@ -214,12 +214,12 @@ class Trollop < ::Test::Unit::TestCase
214
214
  assert_equal false, opts[:arg_muffin]
215
215
  end
216
216
 
217
- def test_short_autocreation_detects_running_out
217
+ def test_short_autocreation_is_ok_with_running_out_of_chars
218
218
  @p.opt :arg1 # auto: a
219
219
  @p.opt :arg2 # auto: r
220
220
  @p.opt :arg3 # auto: g
221
221
  @p.opt :arg4 # auto: uh oh!
222
- assert_raises(ArgumentError) { @p.parse [] }
222
+ assert_nothing_raised { @p.parse [] }
223
223
  end
224
224
 
225
225
  def test_short_can_be_nothing
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trollop
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.14"
4
+ version: "1.15"
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Morgan
@@ -9,11 +9,32 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-19 00:00:00 -04:00
12
+ date: 2009-09-30 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
16
- description: "Documentation quickstart: See Trollop::options (for some reason rdoc isn't linking that; it's in the top right of the screen if you're browsing online) and then Trollop::Parser#opt. Also see the examples at http://trollop.rubyforge.org/. == DESCRIPTION == REQUIREMENTS * A burning desire to write less code. == INSTALL * gem install trollop == LICENSE Copyright (c) 2008 William Morgan. Trollop is distributed under the same terms as Ruby."
16
+ description: |+
17
+ Documentation quickstart: See Trollop::options (for some reason rdoc isn't
18
+ linking that; it's in the top right of the screen if you're browsing online)
19
+ and then Trollop::Parser#opt. Also see the examples at
20
+ http://trollop.rubyforge.org/.
21
+
22
+ == DESCRIPTION
23
+
24
+ == REQUIREMENTS
25
+
26
+ * A burning desire to write less code.
27
+
28
+ == INSTALL
29
+
30
+ * gem install trollop
31
+
32
+ == LICENSE
33
+
34
+ Copyright (c) 2008--2009 William Morgan. Trollop is distributed under the same
35
+ terms as Ruby.
36
+
37
+
17
38
  email: wmorgan-trollop@masanjin.net
18
39
  executables: []
19
40
 
@@ -34,6 +55,8 @@ files:
34
55
  - test/test_trollop.rb
35
56
  has_rdoc: true
36
57
  homepage: http://trollop.rubyforge.org
58
+ licenses: []
59
+
37
60
  post_install_message:
38
61
  rdoc_options:
39
62
  - --main
@@ -55,9 +78,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
78
  requirements: []
56
79
 
57
80
  rubyforge_project: trollop
58
- rubygems_version: 1.3.1
81
+ rubygems_version: 1.3.2
59
82
  signing_key:
60
- specification_version: 2
83
+ specification_version: 3
61
84
  summary: Trollop is a commandline option parser for Ruby that just gets out of your way. One line of code per option is all you need to write. For that, you get a nice automatically-generated help page, robust option parsing, command subcompletion, and sensible defaults for everything you don't specify.
62
85
  test_files:
63
86
  - test/test_trollop.rb