diff options
author | elijah <elijah@riseup.net> | 2012-11-16 14:30:20 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2012-11-16 14:30:20 -0800 |
commit | 76a3a736cfb50cb1c6d926d1e3afb0f504818157 (patch) | |
tree | 95df178ce78ba5220eea267bdb21a04f2f975c75 /lib/leap_cli/log.rb | |
parent | beb6496309b3640d957428b52b4906a1279457ce (diff) | |
download | leap_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.rb | 14 |
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 |