summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRein Henrichs <rein@puppetlabs.com>2010-08-17 18:02:07 -0700
committerRein Henrichs <rein@puppetlabs.com>2010-10-04 14:10:49 -0700
commitb5c85de39edbb083d562dafd96fe507fbcd2f43d (patch)
treeab86f070f5d5f9bef7b72c257750d72851113868 /lib
parentebcb81be7408cfb8bd2bcb86f98ae6a98a6c70a5 (diff)
downloadfacter-b5c85de39edbb083d562dafd96fe507fbcd2f43d.tar.gz
facter-b5c85de39edbb083d562dafd96fe507fbcd2f43d.tar.xz
facter-b5c85de39edbb083d562dafd96fe507fbcd2f43d.zip
[#4563] Add a --trace option to the binary
Diffstat (limited to 'lib')
-rw-r--r--lib/facter/application.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/facter/application.rb b/lib/facter/application.rb
index 51dbd14..b80d07c 100644
--- a/lib/facter/application.rb
+++ b/lib/facter/application.rb
@@ -44,8 +44,12 @@ module Facter
end
rescue => e
- $stderr.puts "Error: #{e}"
- exit(12)
+ if options && options[:trace]
+ raise e
+ else
+ $stderr.puts "Error: #{e}"
+ exit(12)
+ end
end
private
@@ -54,6 +58,7 @@ module Facter
options = {}
OptionParser.new do |opts|
opts.on("-y", "--yaml") { |v| options[:yaml] = v }
+ opts.on( "--trace") { |v| options[:trace] = v }
opts.on("-d", "--debug") { |v| Facter.debugging(1) }
opts.on("-p", "--puppet") { |v| load_puppet }