Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
[ANN] CoolOptions 1.0.3 has been released
Nathaniel Talbott
12/9/2006 8:27:00 PM
CoolOptions version 1.0.3 has been released!
http://cooloptions.ruby...
CoolOptions is a simple wrapper around optparse that provides less
configuration and more convenience for doing command-line option
handling.
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. An example of using it:
$ cat new_rails_project
require 'cooloptions'
options = CoolOptions.parse!("[options] PROJECTNAME") do |o|
o.on "repository URL", "Remote subversion repository."
o.on "svk", "Use svk.", true
o.on "project-path PATH", "Root of project workspaces.",
File.expand_path("~/svk")
o.on "l)repository-path PATH", "Remote repository path.", "/"
o.on "mirror-path SVKPATH", "SVK mirror path.", "//"
o.on "local-pa(t)h SVKPATH", "SVK local path.",
"//local"
o.on "create-structure", "Create trunk/tags/branches structure.", true
o.on "finish", "Prep and commit the new project.", true
o.after do |r|
r.project_path = File.expand_path(r.project_path)
o.error("Invalid path.") unless File.exist?(r.project_path)
r.project_name = ARGV.shift
o.error("Project name is required.") unless r.project_name
o.error("Project name is too funky.") unless /^\w+$/ =~ r.project_name
end
end
p options.svk
p options.project_path
p options.repository
p options.create_structure
p options.project_name
$ ./new_rails_project --no-svk -r
http://ter...
/svn/... myproject
false
"/Users/ntalbott/svk"
"
http://ter...
/svn/..."
true
"myproject"
More details can be found in the documentation, available at the URL above.
Feedback is welcome, and I hope you find CoolOptions useful and
enjoyable to use!
--
Nathaniel Talbott
http://ter...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
[ANN] CoolOptions 1.0.3 has been released
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password