aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/log.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2012-11-16 14:30:20 -0800
committerelijah <elijah@riseup.net>2012-11-16 14:30:20 -0800
commit76a3a736cfb50cb1c6d926d1e3afb0f504818157 (patch)
tree95df178ce78ba5220eea267bdb21a04f2f975c75 /lib/leap_cli/log.rb
parentbeb6496309b3640d957428b52b4906a1279457ce (diff)
downloadleap_cli-76a3a736cfb50cb1c6d926d1e3afb0f504818157.tar.gz
leap_cli-76a3a736cfb50cb1c6d926d1e3afb0f504818157.tar.bz2
added CSR ability (and vendored certificate_authority gem, so we can get the unreleased fixes we need).
Diffstat (limited to 'lib/leap_cli/log.rb')
-rw-r--r--lib/leap_cli/log.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/leap_cli/log.rb b/lib/leap_cli/log.rb
index 1cc1c6a..0821177 100644
--- a/lib/leap_cli/log.rb
+++ b/lib/leap_cli/log.rb
@@ -8,6 +8,12 @@ module LeapCli
def log_level=(value)
@log_level = value
end
+ def indent_level
+ @indent_level ||= 0
+ end
+ def indent_level=(value)
+ @indent_level = value
+ end
end
##
@@ -34,7 +40,8 @@ def log(*args)
level = args.grep(Integer).first || 1
title = args.grep(Symbol).first
message = args.grep(String).first
- options = args.grep(Hash).first || {:indent => 0}
+ options = args.grep(Hash).first || {}
+ options[:indent] ||= LeapCli.indent_level
if message && LeapCli.log_level >= level
print " " * (options[:indent]+1)
if options[:indent] > 0
@@ -66,5 +73,10 @@ def log(*args)
end
end
puts "#{message}"
+ if block_given?
+ LeapCli.indent_level += 1
+ yield
+ LeapCli.indent_level -= 1
+ end
end
end