cooloptions 1.0.4 → 1.0.5
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/History.txt +4 -0
- data/README.txt +1 -0
- data/Rakefile +1 -1
- data/lib/cooloptions.rb +8 -1
- data/samples/literate.rb +1 -0
- data/samples/new_rails_project +1 -0
- data/test/test_cooloptions.rb +6 -0
- metadata +2 -2
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -13,6 +13,7 @@ As a huge fan of optparse due to its flexibility, self-documenting nature, and e
|
|
13
13
|
=== Declaration:
|
14
14
|
|
15
15
|
options = CoolOptions.parse!("[options] PROJECTNAME") do |o|
|
16
|
+
o.desc 'Sets up a new Rails project.'
|
16
17
|
o.on "repository URL", "Remote subversion repository."
|
17
18
|
o.on "svk", "Use svk.", true
|
18
19
|
o.on "project-path PATH", "Root of project workspaces.", File.expand_path("~/svk")
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require './lib/cooloptions.rb'
|
|
5
5
|
Hoe.new('cooloptions', CoolOptions::VERSION) do |p|
|
6
6
|
p.rubyforge_name = 'cooloptions'
|
7
7
|
p.summary = 'CoolOptions is a simple wrapper around optparse that provides less configuration and more convenience for doing command-line option handling.'
|
8
|
-
p.description = 'As a huge fan of optparse due to its flexibility, self-documenting nature, and ease of use, I nevertheless found myself doing almost the exact same thing with it over and over again, and decided to write a thin wrapper around it to handle the common cases. Thus CoolOptions was born.'
|
8
|
+
p.description = 'As a huge fan of optparse due to its flexibility, self-documenting nature, and ease of use, I nevertheless found myself doing almost the exact same thing with it over and over again, and decided to write a thin wrapper around it to handle the common cases. Thus CoolOptions was born. CoolOptions is a simple wrapper around optparse that provides less configuration and more convenience for doing command-line option handling.'
|
9
9
|
p.url = 'http://cooloptions.rubyforge.org/'
|
10
10
|
p.changes = p.paragraphs_of('History.txt', 0..1).join("\n\n")
|
11
11
|
p.author = "Nathaniel Talbott"
|
data/lib/cooloptions.rb
CHANGED
@@ -11,7 +11,7 @@ require 'ostruct'
|
|
11
11
|
# :include:samples/literate.rb
|
12
12
|
|
13
13
|
class CoolOptions
|
14
|
-
VERSION = '1.0.
|
14
|
+
VERSION = '1.0.5' #:nodoc:
|
15
15
|
|
16
16
|
class Error < StandardError #:nodoc:
|
17
17
|
end
|
@@ -53,6 +53,13 @@ class CoolOptions
|
|
53
53
|
@after = nil
|
54
54
|
end
|
55
55
|
|
56
|
+
# Adds additional descriptive text to the help text.
|
57
|
+
def desc(string)
|
58
|
+
string.each_line do |s|
|
59
|
+
@parser.separator s.chomp
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
56
63
|
NO_DEFAULT = Object.new #:nodoc:
|
57
64
|
|
58
65
|
# Called on cooloptions within the #parse! block to add options to parse on.
|
data/samples/literate.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'cooloptions'
|
2
2
|
|
3
3
|
options = CoolOptions.parse!('[options] NAME') do |cooloptions|
|
4
|
+
cooloptions.desc 'This is a literate sample of what CoolOptions can do.' # Adds some extra descriptive text.
|
4
5
|
cooloptions.on 'option STRING', 'Description', 'default' # Matches '-o string' or '--option string' or uses the 'default'.
|
5
6
|
|
6
7
|
cooloptions.on 'required VALUE', 'Required' # Because there's no default, the option is required.
|
data/samples/new_rails_project
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'cooloptions'
|
2
2
|
|
3
3
|
options = CoolOptions.parse!("[options] PROJECTNAME") do |o|
|
4
|
+
o.desc 'Sets up a new Rails project.'
|
4
5
|
o.on "repository URL", "Remote subversion repository."
|
5
6
|
o.on "svk", "Use svk.", true
|
6
7
|
o.on "project-path PATH", "Root of project workspaces.", File.expand_path("~/svk")
|
data/test/test_cooloptions.rb
CHANGED
@@ -71,6 +71,10 @@ class TestCoolOptions < Test::Unit::TestCase
|
|
71
71
|
def test_should_output_help
|
72
72
|
begin
|
73
73
|
r = CoolOptions.parse!('details', %w(--help)) do |o|
|
74
|
+
o.desc <<EOD.chomp
|
75
|
+
This is a sweet little non-existent command.
|
76
|
+
Really!
|
77
|
+
EOD
|
74
78
|
o.on 'a', 'aa'
|
75
79
|
end
|
76
80
|
rescue SystemExit
|
@@ -80,6 +84,8 @@ class TestCoolOptions < Test::Unit::TestCase
|
|
80
84
|
assert rescued
|
81
85
|
assert_equal <<EOH, @out.string
|
82
86
|
Usage: #{File.basename($0)} details
|
87
|
+
This is a sweet little non-existent command.
|
88
|
+
Really!
|
83
89
|
-a, --[no-]a aa
|
84
90
|
-h, --help This help info.
|
85
91
|
EOH
|
metadata
CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: cooloptions
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.0.
|
6
|
+
version: 1.0.5
|
7
7
|
date: 2006-12-09 00:00:00 -05:00
|
8
8
|
summary: CoolOptions is a simple wrapper around optparse that provides less configuration and more convenience for doing command-line option handling.
|
9
9
|
require_paths:
|
@@ -11,7 +11,7 @@ require_paths:
|
|
11
11
|
email: nathaniel@terralien.com
|
12
12
|
homepage: http://cooloptions.rubyforge.org/
|
13
13
|
rubyforge_project: cooloptions
|
14
|
-
description: As a huge fan of optparse due to its flexibility, self-documenting nature, and ease of use, I nevertheless found myself doing almost the exact same thing with it over and over again, and decided to write a thin wrapper around it to handle the common cases. Thus CoolOptions was born.
|
14
|
+
description: As a huge fan of optparse due to its flexibility, self-documenting nature, and ease of use, I nevertheless found myself doing almost the exact same thing with it over and over again, and decided to write a thin wrapper around it to handle the common cases. Thus CoolOptions was born. CoolOptions is a simple wrapper around optparse that provides less configuration and more convenience for doing command-line option handling.
|
15
15
|
autorequire:
|
16
16
|
default_executable:
|
17
17
|
bindir: bin
|