S
Steve Tuckner
What is usage?
===========
Usage is simple way to access command line parameters for quick scripts
that you write where you don't want to even think about command line
processing. You just need to type in what would be the Unix synopsis for
the command and the usage does the rest.
What is new in this version (0.0.4)?
========================
This version now takes argument typing to a new level. Argument types
can be defined through a new plug-in architecture. Also with this
version, there are new argument types to handle common io operations
such as reading/writing files and reading http:// and ftp:// URI's
(thanks to open-uri). The gem and require name are now in lowercase!
Give me an example?
==============
Here is the world's shortest type checked URI (or file) to file copy
script. This will check if you want to over-write an existing file
(because of the >? instead of just >) and will give errors if the the
URI does not exist. It automatically converts www. and ftp. to
http://www. and ftp://ftp. respectively. The first argument can also
just be a filename.
uricopy.rb
----------
#!/usr/bin/env ruby
require "usage"
Usage.new "<@infile >?outfile" do |u|
u.outfile.write(u.infile.read)
end
run it by entering:
uricopy.rb www.yahoo.com out.txt
How can I get it?
============
gem install usage
Where is it at?
=============
http://raa.ruby-lang.org/project/usage/
http://rubyforge.org/projects/usage
Thanks,
Steve Tuckner
===========
Usage is simple way to access command line parameters for quick scripts
that you write where you don't want to even think about command line
processing. You just need to type in what would be the Unix synopsis for
the command and the usage does the rest.
What is new in this version (0.0.4)?
========================
This version now takes argument typing to a new level. Argument types
can be defined through a new plug-in architecture. Also with this
version, there are new argument types to handle common io operations
such as reading/writing files and reading http:// and ftp:// URI's
(thanks to open-uri). The gem and require name are now in lowercase!
Give me an example?
==============
Here is the world's shortest type checked URI (or file) to file copy
script. This will check if you want to over-write an existing file
(because of the >? instead of just >) and will give errors if the the
URI does not exist. It automatically converts www. and ftp. to
http://www. and ftp://ftp. respectively. The first argument can also
just be a filename.
uricopy.rb
----------
#!/usr/bin/env ruby
require "usage"
Usage.new "<@infile >?outfile" do |u|
u.outfile.write(u.infile.read)
end
run it by entering:
uricopy.rb www.yahoo.com out.txt
How can I get it?
============
gem install usage
Where is it at?
=============
http://raa.ruby-lang.org/project/usage/
http://rubyforge.org/projects/usage
Thanks,
Steve Tuckner