summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2006-05-31 00:41:17 +0000
committerluke <luke@1f5c1d6a-bddf-0310-8f58-fc49e503516a>2006-05-31 00:41:17 +0000
commit99086288143a3b2448671441732ddfa8e3e966f2 (patch)
tree0fea6f635faa4520bcd7096eff0aa9d8a3bf4882 /bin
parenta15c8f55b791a407fada52765a3e8a14a7d31f5c (diff)
downloadfacter-99086288143a3b2448671441732ddfa8e3e966f2.tar.gz
facter-99086288143a3b2448671441732ddfa8e3e966f2.tar.xz
facter-99086288143a3b2448671441732ddfa8e3e966f2.zip
Adding some documentation to the binary
git-svn-id: http://reductivelabs.com/svn/facter/trunk@123 1f5c1d6a-bddf-0310-8f58-fc49e503516a
Diffstat (limited to 'bin')
-rwxr-xr-xbin/facter61
1 files changed, 55 insertions, 6 deletions
diff --git a/bin/facter b/bin/facter
index f4a8b54..4e905be 100755
--- a/bin/facter
+++ b/bin/facter
@@ -1,13 +1,56 @@
#!/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
@@ -27,8 +70,12 @@ result.each { |opt,arg|
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)
@@ -73,3 +120,5 @@ facts.each { |name,value|
puts "%s => %s" % [name,value]
end
}
+
+# $Id: facter,v 1.1.1.1 2004/03/21 21:06:27 luke Exp $