public
Description: A command-line client for Amazon Web Services
Homepage: http://rubyforge.org/projects/cliaws
Clone URL: git://github.com/francois/cliaws.git
Search Repo:
cliaws / bin / clisdb
100644 44 lines (34 sloc) 0.946 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env ruby
#
# Created on 2008-4-12.
# Copyright (c) 2008. All rights reserved.
 
begin
  require 'rubygems'
rescue LoadError
  # no rubygems to load, so we fail silently
end
 
require 'optparse'
 
# NOTE: the option -p/--path= is given as an example, and should probably be replaced in your application.
 
OPTIONS = {
  :path => '~'
}
MANDATORY_OPTIONS = %w( )
 
parser = OptionParser.new do |opts|
  opts.banner = <<BANNER
This application is wonderful because...
 
Usage: #{File.basename($0)} [options]
 
Options are:
BANNER
  opts.separator ""
  opts.on("-p", "--path=PATH", String,
          "The root path for selecting files",
          "Default: ~") { |OPTIONS[:path]| }
  opts.on("-h", "--help",
          "Show this help message.") { puts opts; exit }
  opts.parse!(ARGV)
 
  if MANDATORY_OPTIONS && MANDATORY_OPTIONS.find { |option| OPTIONS[option.to_sym].nil? }
    puts opts; exit
  end
end
 
path = OPTIONS[:path]
 
# do stuff