diff options
author | Adam Jacob <adam@hjksolutions.com> | 2008-12-02 02:09:19 -0800 |
---|---|---|
committer | Adam Jacob <adam@hjksolutions.com> | 2008-12-02 02:09:19 -0800 |
commit | 69a778d4db0752d111927c560923fda6fbc6c7d7 (patch) | |
tree | bcb424bd3a4e756a68b9a0bf7089af17ac4eef25 /bin | |
parent | 3a9543f8dbff45b2a393d44ef1c72ede0a26d6af (diff) | |
download | ohai-69a778d4db0752d111927c560923fda6fbc6c7d7.tar.gz |
Ohai lives - first meaningful commit
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ohai | 27 |
1 files changed, 24 insertions, 3 deletions
@@ -18,17 +18,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +$: << File.join(File.dirname(__FILE__), "..", "lib") require 'optparse' require 'rubygems' -#require 'ohai' +require 'ohai' require 'json' config = { + :directory => nil, + :file => nil, :kthxbye => false } opts = OptionParser.new do |opts| - opts.banner = "Usage: #{$0} [-d DIR|-r FILE] (options)" + opts.banner = "Usage: #{$0} (options)" + opts.on("-d", "--directory NAME", "A directory to add to the Ohai search path") do |d| + config[:directory] = d + end + opts.on("-f", "--file NAME", "A file to run Ohai against") do |f| + config[:file] = f + end opts.on("-k", "--kthxbye", "LOLcats") do |k| config[:kthxbye] = true end @@ -41,4 +50,16 @@ opts.parse!(ARGV) if config[:kthxbye] puts JSON.generate({ :lolcat => "http://icanhascheezburger.com/?random" }) -end
\ No newline at end of file +end + +ohai = Ohai::System.new +if config[:file] + ohai.from_file(config[:file]) +else + if config[:directory] + Ohai::Config[:plugin_path] << config[:directory] + end + ohai.all_plugins +end + +puts ohai.json_pretty_print |