Sha256: e7d79a8945eb7d48b985a95b8dfd79413910e46554f8910621273633076b3f31
Contents?: true
Size: 1.4 KB
Versions: 4
Compression:
Stored size: 1.4 KB
Contents
#!/usr/bin/env ruby require 'trollop' require 'onering' require 'hashlib' require 'rainbow' require 'pp' plugins = Onering::CLI.submodules.collect{|i| i.name.split('::').last.downcase } global = Trollop::options do banner <<-EOS onering command line client utility Usage: onering [global] [plugin] [subcommand] [options] where [global] options are: EOS opt :url, "The URL of the Onering server to connect to", :short => "-s", :type => :string opt :path, "The base path to prepend to all requests (default: /api)", :type => :string opt :format, "The output format for return values (i.e.: json, yaml, text)", :default => 'text', :short => "-t", :type => :string opt :sslkey, "Location of the SSL client key to use for authentication", :short => "-c", :type => :string opt :apikey, "The API token to use for authentication", :short => "-k", :type => :string opt :quiet, "Suppress standard output", :short => '-q' stop_on plugins end plugin = ARGV.shift Trollop::die("plugin argument is requried") if plugin.nil? if plugins.include?(plugin) begin plugin = Onering::CLI.const_get(plugin.capitalize) plugin.configure(global) rv = plugin.run(ARGV) Onering::CLI.output(rv, global[:format]) rescue Onering::API::Errors::Exception => e STDERR.puts("[#{e.class.name.split('::').last}]".foreground(:red) + " #{e.message}") exit 1 end else Trollop::die("unknown plugin #{plugin}") end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
onering-client-0.0.53 | bin/onering |
onering-client-0.0.52 | bin/onering |
onering-client-0.0.51 | bin/onering |
onering-client-0.0.50 | bin/onering |