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.
| 15 16 17 18 19 20 21 22 23 | # File 'lib/inspec/env_printer.rb', line 15 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.
| 7 8 9 | # File 'lib/inspec/env_printer.rb', line 7 def shell @shell end | 
Instance Method Details
#print_and_exit! ⇒ Object
| 25 26 27 28 29 30 31 32 33 | # File 'lib/inspec/env_printer.rb', line 25 def print_and_exit! exit_no_shell unless have_shell? exit_no_completion unless have_shell_completion? print_completion_for_shell print_detection_warning($stdout) if @detected print_usage_guidance exit 0 end |