Sha256: 75b21e0bcd3524b7b7cb3069be9fca4df3cd1358bd8887ecc224656c11c14b33

Contents?: true

Size: 692 Bytes

Versions: 2

Compression:

Stored size: 692 Bytes

Contents

#!/usr/bin/env ruby

require 'optparse'
require 'zway-cli'

options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: bin.rb [options]"

  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
    options[:verbose] = v
  end
end.parse!

# p options
# p ARGV

zway = ZWay::Client.new
zway.load_config!

# puts "Aliases:"
# puts zway.aliases

if ARGV.last == "login"
  zway.login!
elsif ARGV.last == "aliases"
  puts "Known Aliases:"
  zway.aliases.each do |a|
    a.each do |k,v|
      puts "#{k} => #{v}"
    end
  end
else

  device_id = ARGV.shift

  while command = ARGV.shift
    if zway.respond_to?( command.to_sym )
      zway.send( command.to_sym, device_id )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zway-cli-0.1.2 exe/zway
zway-cli-0.1.1 exe/zway