bin/facter in facter-1.1.1 vs bin/facter in facter-1.3.3
- old
+ new
@@ -1,15 +1,58 @@
#!/usr/bin/env ruby
-
-#--------------------
-# duh, it's facter!
#
-# $Id: facter,v 1.1.1.1 2004/03/21 21:06:27 luke Exp $
+# = Synopsis
+#
+# Collect and display facts about the system.
+#
+# = Usage
+#
+# facter [-d|--debug] [-h|--help] [-v|--version] [fact] [fact] [...]
+#
+# = Description
+#
+# Collect and display facts about the current system. The library behind
+# Facter is easy to expand, making Facter an easy way to collect information
+# about a system from within the shell or within Ruby.
+#
+# If no facts are specifically asked for, then all facts will be returned.
+#
+# = Options
+#
+# debug::
+# Enable debugging.
+#
+# help::
+# Print this help message
+#
+# version::
+# Print the version and exit.
+#
+# = Example
+#
+# facter kernel
+#
+# = Author
+#
+# Luke Kanies
+#
+# = Copyright
+#
+# Copyright (c) 2006 Reductive Labs, LLC
+# Licensed under the GNU Public License
require 'getoptlong'
require 'facter'
+$haveusage = true
+
+begin
+ require 'rdoc/usage'
+rescue LoadError
+ $haveusage = false
+end
+
$debug = 0
config = nil
result = GetoptLong.new(
@@ -25,12 +68,16 @@
puts "%s" % Facter.version
exit
when "--debug"
Facter.debugging(1)
when "--help"
- puts "There is no help yet"
- exit
+ if $haveusage
+ RDoc::usage && exit
+ else
+ puts "No help available unless you have RDoc::usage installed"
+ exit
+ end
else
$stderr.puts "Invalid option '#{opt}'"
exit(12)
end
}
@@ -65,7 +112,13 @@
end
}
end
facts.each { |name,value|
- puts "%s => %s" % [name,value]
+ if facts.length == 1
+ puts value
+ else
+ puts "%s => %s" % [name,value]
+ end
}
+
+# $Id: facter,v 1.1.1.1 2004/03/21 21:06:27 luke Exp $