summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorjtimberman <joshua@opscode.com>2009-06-17 22:11:22 -0600
committerjtimberman <joshua@opscode.com>2009-06-17 22:11:22 -0600
commit98ae83de837e43d0390329e141393b7d3d0584f8 (patch)
treea9d6e9ab3f6fd521f2ffbbc43efc183a1e459389 /bin
parentcfea6505c0df5be1451317ebaa855809802719f1 (diff)
downloadohai-98ae83de837e43d0390329e141393b7d3d0584f8.tar.gz
ohai-6, preliminary support for returning named attributes, toplevel only
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ohai15
1 files changed, 13 insertions, 2 deletions
diff --git a/bin/ohai b/bin/ohai
index 9f4b2bb0..0b69ee9b 100755
--- a/bin/ohai
+++ b/bin/ohai
@@ -42,12 +42,17 @@ opts = OptionParser.new do |opts|
opts.on("-l", "--loglevel NAME", "Set log level for Ohai") do |l|
config[:log_level] = l.to_sym
end
+ opts.on("-v", "--version", "Display Ohai version") do |v|
+ puts "Ohai, version #{::Ohai::VERSION}"
+ exit
+ end
opts.on_tail("-h", "--help", "Show this message") do
puts opts
exit
end
end
-opts.parse!(ARGV)
+
+attributes = opts.parse(ARGV)
ohai = Ohai::System.new
@@ -63,4 +68,10 @@ else
ohai.all_plugins
end
-puts ohai.json_pretty_print
+if attributes.length > 0
+ attributes.each do |a|
+ puts ohai.attributes_print(a)
+ end
+else
+ puts ohai.json_pretty_print
+end \ No newline at end of file