Class: Depot::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/depot/cli.rb

Instance Method Summary collapse

Constructor Details

#initialize(stdout: $stdout, stderr: $stderr) ⇒ CLI

Returns a new instance of CLI.



9
10
11
12
# File 'lib/depot/cli.rb', line 9

def initialize(stdout: $stdout, stderr: $stderr)
  @stdout = stdout
  @stderr = stderr
end

Instance Method Details

#run(argv) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/depot/cli.rb', line 14

def run(argv)
  command = argv.shift
  case command
  when "inspect"
    inspect_command(argv)
  when "install"
    install_command(argv)
  when "list"
    list_command(argv)
  when "info"
    info_command(argv)
  when "uninstall", "remove"
    uninstall_command(argv)
  when "update"
    update_command(argv)
  when "update-source"
    update_source_command(argv)
  when "sandbox"
    sandbox_command(argv)
  when "doctor"
    doctor_command(argv)
  when "settings"
    settings_command(argv)
  when "-h", "--help", nil
    help
    0
  when "-v", "--version"
    @stdout.puts "Depot #{Depot::VERSION}"
    0
  else
    @stderr.puts "Unknown command: #{command}"
    help(@stderr)
    1
  end
end