Sha256: dbb46eac975f3b3994eec86d83eb03421d7eeb26282f0d09b2b4a431eb7b3f76
Contents?: true
Size: 695 Bytes
Versions: 3
Compression:
Stored size: 695 Bytes
Contents
class OpenbdCLI def initialize(argv) @argv = argv parse_option end def call if method_name.nil? puts @opts elsif params.empty? puts OpenBD.send(method_name).to_json else puts OpenBD.send(method_name, params).to_json end end private def method_name @argv[0] end def params @argv[1..-1] end def parse_option @opts = Slop.parse do |o| o.banner = "Usage: openbd <method> [arguments] [options]" o.on '-v', '--version', 'print the version' do puts "openbd_api #{Openbd::VERSION}" exit end o.on '-h', '--help', 'print help' do puts o exit end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
openbd_api-0.3.3 | lib/openbd/openbd_cli.rb |
openbd_api-0.3.2 | lib/openbd/openbd_cli.rb |
openbd_api-0.3.1 | lib/openbd/openbd_cli.rb |