Class: Kitchen::Command::List

Inherits:
Base
  • Object
show all
Defined in:
lib/kitchen/command/list.rb

Overview

Command to list one or more instances.

Author:

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from Logging

#banner, #debug, #error, #fatal, #info, #warn

Constructor Details

This class inherits a constructor from Kitchen::Command::Base

Instance Method Details

#callObject

Invoke the command.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/kitchen/command/list.rb', line 28

def call
  result = parse_subcommand(args.first)
  if options[:debug]
    die "The --debug flag on the list subcommand is deprecated, " \
      "please use `kitchen diagnose'."
  elsif options[:bare]
    puts Array(result).map(&:name).join("\n")
  elsif options[:json]
    puts JSON.pretty_generate(Array(result).map { |r| to_hash(r) })
  else
    list_table(result)
  end
end