Module: Jaxx::CLI
- Defined in:
- lib/jaxx/cli.rb
Class Method Summary collapse
Class Method Details
.aboutme_parser ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/jaxx/cli.rb', line 39 def self.aboutme_parser OptionParser.new do |o| o. = "jaxx-aboutme [options]" o.on('-d', '--display') { |d| ['display'] = d } o.on('-h', '--help') { o } end end |
.default_parser ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/jaxx/cli.rb', line 24 def self.default_parser OptionParser.new do |o| o. = "jaxx [options]" o.on('-b', '--bucket [BUCKET]') { |b| ['bucket'] = b } o.on('-k', '--access-key [ACCESS_KEY]') { |k| ['access_key'] = k } o.on('-s', '--access-secret [ACCESS_SECRET]') { |s| ['access_secret'] = s } o.on('-f', '--file [FILE]') { |f| ['file'] = f } o.on('-n', '--name [name]') { |f| ['filename'] = f } o.on('-p', '--privacy [privacy]') { |p| ['privacy'] = p } o.on('-r', '--retries [retries]') { |r| ['retries'] = r } o.on('-h', '--help') { o } end end |
.execute(meth, args) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jaxx/cli.rb', line 7 def self.execute meth, args case meth when :upload, :download default_parser.parse!(args) (Jaxx.logger.write(default_parser) and exit) if .empty? when :aboutme aboutme_parser.parse!(args) (Jaxx.logger.write(aboutme_parser) and exit) unless ['display'] end Jaxx.send(meth, ) rescue RuntimeError => exc Jaxx.logger.write "An error occurred: #{exc.}\n" exit 1 end |
.options ⇒ Object
47 48 49 |
# File 'lib/jaxx/cli.rb', line 47 def self. @options ||= {} end |