Class: MilkTea::ToolchainCLI

Inherits:
Object
  • Object
show all
Defined in:
lib/milk_tea/tooling/toolchain_cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv, out:, err:, help_printer:) ⇒ ToolchainCLI

Returns a new instance of ToolchainCLI.



9
10
11
12
13
14
15
# File 'lib/milk_tea/tooling/toolchain_cli.rb', line 9

def initialize(argv, out:, err:, help_printer:)
  @argv = argv.dup
  @out = out
  @err = err
  @help_printer = help_printer
  @quiet = false
end

Class Method Details

.start(argv = ARGV, out:, err:, help_printer:) ⇒ Object



5
6
7
# File 'lib/milk_tea/tooling/toolchain_cli.rb', line 5

def self.start(argv = ARGV, out:, err:, help_printer:)
  new(argv, out:, err:, help_printer:).start
end

Instance Method Details

#startObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/milk_tea/tooling/toolchain_cli.rb', line 17

def start
  extract_options!

  subcommand = @argv.shift
  unless subcommand
    @err.puts("missing toolchain subcommand")
    print_help
    return 1
  end

  case subcommand
  when "bootstrap"
    bootstrap_command
  when "doctor"
    doctor_command
  when "tools"
    tools_command
  else
    @err.puts("unknown toolchain subcommand #{subcommand}")
    print_help
    1
  end
end