Class: Inspec::EnvPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/env_printer.rb

Defined Under Namespace

Classes: TemplateContext

Instance Method Summary collapse

Constructor Details

#initialize(command_class, shell = nil) ⇒ EnvPrinter

Returns a new instance of EnvPrinter.



8
9
10
11
12
13
14
15
16
# File 'lib/inspec/env_printer.rb', line 8

def initialize(command_class, shell = nil)
  if !shell
    @detected = true
    @shell = Inspec::ShellDetector.new.shell
  else
    @shell = shell
  end
  @command_class = command_class
end

Instance Method Details



18
19
20
21
22
23
24
25
26
# File 'lib/inspec/env_printer.rb', line 18

def print_and_exit!
  exit_no_shell if !have_shell?
  exit_no_completion if !have_shell_completion?

  print_completion_for_shell
  print_detection_warning($stdout) if @detected
  print_usage_guidance
  exit 0
end