Sha256: cc9f3585e69a7670b81a52438ae121ed4dcf440d9da8c04f3ef6ae8e07ce7362
Contents?: true
Size: 1.65 KB
Versions: 3
Compression:
Stored size: 1.65 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'gli' require 'terminal-table' require 'colorize' module Eufycam class CLI extend GLI::App flag 'email', default_value: ENV['EUFYCAM_EMAIL'], arg_name: 'EMAIL' flag 'password', mask: true, default_value: ENV['EUFYCAM_PASSWORD'], arg_name: 'PASSWORD' command :devices do |devices| devices.command :timelapse do |timelapse| timelapse.flag 'device-name', arg_name: 'DEVICE_NAME' timelapse.action do |_global_options, options, _args| # client = Client.new(global_options.slice('username', 'password')) puts "capture a timelapse #{options['device-name']}" end end devices.command 'start-stream' do |start_stream| start_stream.action do |global_options, options, _args| client = Client.new(**global_options.slice(:email, :password)) puts client.start_stream( device_name: options['device-name'] ).to_json end end devices.command 'play' do |play| play.action do |global_options, options, _args| client = Client.new(**global_options.slice(:email, :password)) url = client.start_stream( device_name: options['device-name'] )['url'] `ffplay -loglevel panic #{url}` end end devices.command 'list' do |list| list.action do |global_options, _options, _args| client = Client.new(**global_options.slice(:email, :password)) results = client.list_devices puts results.to_json end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
eufycam-0.4.0 | lib/eufycam/cli.rb |
eufycam-0.3.0 | lib/eufycam/cli.rb |
eufycam-0.2.0 | lib/eufycam/cli.rb |