Class: Rpremote::DfuCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/rpremote/dfu_command.rb,
sig/rpremote.rbs

Constant Summary collapse

DEFAULT_TIMEOUT =

Returns:

  • (Float)
20.0
TYPES =

Returns:

  • (Hash[String, String])
{ ".rb" => "RUBY", ".mrb" => "RITE" }.freeze

Class Method Summary collapse

Class Method Details

.run(args, defaults:, output: $stdout, services: {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rpremote/dfu_command.rb', line 10

def self.run(args, defaults:, output: $stdout, services: {})
  default_services = { serial: Serial, device: Device, modem: PicoModem, runner: Runner, compiler: DfuCompiler }
  services = default_services.merge(services)
  subcommand = args.shift
  case subcommand
  when "app" then stage(args, defaults, output, services)
  when "compile" then compile(args, defaults, output, services[:compiler])
  when "status" then status(args, defaults, output, services)
  else
    raise ArgumentError,
          "usage: rpremote dfu app FILE [options], dfu compile FILE [options], or dfu status [options]"
  end
end