Sha256: 78fe97a6584df5bb780833115f31d36c59a2d422580524692c315f30b5829c4f
Contents?: true
Size: 1.89 KB
Versions: 2
Compression:
Stored size: 1.89 KB
Contents
= args_parser * http://github.com/shokai/args_parser == DESCRIPTION: ARGV parser - Parse args from command line. == SYNOPSIS: % ruby sample.rb -url http://example.com -o out.html parse ARGV require 'rubygems' require 'args_parser' parser = ArgsParser.parse ARGV do arg :url, 'URL', :alias => :u arg :output, 'output file', :alias => :o, :default => 'out.html' arg :verbose, 'verbose mode' arg :help, 'show help', :alias => :h end if parser.has_option? :help or !parser.has_param?(:url, :output) STDERR.puts parser.help exit 1 end require 'open-uri' puts 'download..' if parser[:verbose] open(parser[:output], 'w+') do |f| f.write open(parser[:url]).read end puts "saved! => #{parser[:output]}" == REQUIREMENTS: * Ruby 1.8.7+ * Ruby 1.9.3+ == INSTALL: * gem install args_parser == LICENSE: (The MIT License) Copyright (c) 2012 Sho Hashimoto Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
args_parser-0.0.2 | README.rdoc |
args_parser-0.0.1 | README.rdoc |