Class: Kontena::Plugin::Shell::DebugCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/kontena/plugin/shell/commands/debug.rb

Instance Attribute Summary

Attributes inherited from Command

#args, #context, #session

Instance Method Summary collapse

Methods inherited from Command

command, completions, description, #has_subcommands?, has_subcommands?, help, #initialize, #run, subcommands

Constructor Details

This class inherits a constructor from Kontena::Plugin::Shell::Command

Instance Method Details

#executeObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/kontena/plugin/shell/commands/debug.rb', line 12

def execute
  case args[1]
  when 'true', 'on', '1'
    ENV['DEBUG'] = 'true'
  when 'api'
    ENV['DEBUG'] = 'api'
  when 'off', 'false', '0'
    ENV.delete('DEBUG')
  when NilClass
    # do nothing
  else
    puts Kontena.pastel.red("Unknown argument '#{args[1]}'")
  end
  puts "Debug #{Kontena.pastel.send(*ENV['DEBUG'] ? [:green, 'on'] : [:red, 'off'])}"
end