diff options
author | luke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a> | 2006-09-19 06:55:52 +0000 |
---|---|---|
committer | luke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a> | 2006-09-19 06:55:52 +0000 |
commit | fe0f2f204fdd5d4c48af93d691cce53061cd1ded (patch) | |
tree | 68acc999c6e42c6f0eda9afa00c81886c5425ba4 /bin | |
parent | 4abbce9119f91179aaa7aeb2f92466cc201a9079 (diff) | |
download | facter-fe0f2f204fdd5d4c48af93d691cce53061cd1ded.tar.gz facter-fe0f2f204fdd5d4c48af93d691cce53061cd1ded.tar.xz facter-fe0f2f204fdd5d4c48af93d691cce53061cd1ded.zip |
Adding yaml support, as requested in #24
git-svn-id: http://reductivelabs.com/svn/facter/trunk@170 1f5c1d6a-bddf-0310-8f58-fc49e503516a
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/facter | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -59,14 +59,21 @@ result = GetoptLong.new( [ "--version", "-v", GetoptLong::NO_ARGUMENT ], [ "--help", "-h", GetoptLong::NO_ARGUMENT ], [ "--debug", "-d", GetoptLong::NO_ARGUMENT ], + [ "--yaml", "-y", GetoptLong::NO_ARGUMENT ], [ "--config", "-c", GetoptLong::REQUIRED_ARGUMENT ] ) +options = { + :yaml => false +} + result.each { |opt,arg| case opt when "--version" puts "%s" % Facter.version exit + when "--yaml" + options[:yaml] = true when "--debug" Facter.debugging(1) when "--help" @@ -113,6 +120,12 @@ else } end +if options[:yaml] + require 'yaml' + puts YAML.dump(facts) + exit(0) +end + facts.sort { |a, b| a[0].to_s <=> b[0].to_s }.each { |name,value| if facts.length == 1 unless value.nil? |