Class: Facter::Cli

Inherits:
Thor
  • Object
show all
Defined in:
lib/facter/framework/cli/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


151
152
153
# File 'lib/facter/framework/cli/cli.rb', line 151

def self.exit_on_failure?
  true
end

Instance Method Details

#list_block_groups(*_args) ⇒ Object



141
142
143
# File 'lib/facter/framework/cli/cli.rb', line 141

def list_block_groups(*_args)
  puts Facter::FactGroups.new.groups.to_yaml.lines[1..-1].join
end

#list_cache_groups(*_args) ⇒ Object



147
148
149
# File 'lib/facter/framework/cli/cli.rb', line 147

def list_cache_groups(*_args)
  puts Facter::FactGroups.new.groups.to_yaml.lines[1..-1].join
end

#man(*args) ⇒ Object



113
114
115
116
117
118
119
120
121
# File 'lib/facter/framework/cli/cli.rb', line 113

def man(*args)
  require 'erb'
  negate_options = %w[block cache custom_facts external_facts]

  template = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'man.erb')
  erb = ERB.new(File.read(template), nil, '-')
  erb.filename = template
  puts erb.result(binding)
end

#query(*args) ⇒ Object



125
126
127
128
129
130
131
# File 'lib/facter/framework/cli/cli.rb', line 125

def query(*args)
  output, status = Facter.to_user_output(@options, *args)
  puts output

  status = 1 if Facter::Log.errors?
  exit status
end

#versionObject



135
136
137
# File 'lib/facter/framework/cli/cli.rb', line 135

def version
  puts Facter::VERSION
end