Class: Inspec::EnvPrinter
- Inherits:
-
Object
- Object
- Inspec::EnvPrinter
- Defined in:
- lib/inspec/env_printer.rb
Defined Under Namespace
Classes: TemplateContext
Constant Summary collapse
- EVAL_COMMANDS =
{ 'bash' => 'eval \"$(inspec env bash)\"', 'fish' => 'inspec env fish > ~/.config/fish/completions/inspec.fish', 'zsh' => 'eval \"$(inspec env zsh)\"', }.freeze
Instance Attribute Summary collapse
-
#shell ⇒ Object
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
-
#initialize(command_class, shell = nil) ⇒ EnvPrinter
constructor
A new instance of EnvPrinter.
- #print_and_exit! ⇒ Object
Constructor Details
#initialize(command_class, shell = nil) ⇒ EnvPrinter
Returns a new instance of EnvPrinter.
16 17 18 19 20 21 22 23 24 |
# File 'lib/inspec/env_printer.rb', line 16 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 Attribute Details
#shell ⇒ Object (readonly)
Returns the value of attribute shell.
8 9 10 |
# File 'lib/inspec/env_printer.rb', line 8 def shell @shell end |
Instance Method Details
#print_and_exit! ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/inspec/env_printer.rb', line 26 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 |