diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-12-28 12:25:17 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-12-28 12:25:17 -0500 |
commit | a4e463e111ba498197315b8c6e5d882eb73be4a8 (patch) | |
tree | 893b67400a7fd540d1b15984d75bda50e8ec34bc /lib/sisu/v4/help.rb | |
parent | v4 v3: debug (internal code use), color markers for line number & file name (diff) |
v4: sisu: --color flag, which toggles color on/off (Closes: #622171)
* the fix here is specific to color on/off for reporting of sisu version
* sisu --version --color-off || sisu -v -k || sisu -kv
* there are various ways to control color output to screen
* --color-off or -k switches color off
* --color or --color-on switches color on, which is usually the default
* --color-toggle or -c toggles the default setting (in most cases)
* sisurc.yml can set default color state which affects most screen output
Diffstat (limited to 'lib/sisu/v4/help.rb')
-rw-r--r-- | lib/sisu/v4/help.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sisu/v4/help.rb b/lib/sisu/v4/help.rb index 391e722d..23afd512 100644 --- a/lib/sisu/v4/help.rb +++ b/lib/sisu/v4/help.rb @@ -63,7 +63,8 @@ module SiSU_Help require_relative 'i18n' # i18n.rb def initialize(request='',color='') @request,@color=request,color - @cX=(color =~/color_off/) \ + @cX=((color =~/color_off/) \ + || (defined? color.act && color.act[:color_state][:set]==:off)) \ ? (SiSU_Screen::Ansi.new('k').cX) : (SiSU_Screen::Ansi.new('yes').cX) fns='help_example_dummy_file_name.sst' @@ -900,7 +901,12 @@ If you have problems check permissions (and if in home directory ownership). version=SiSU_Env::InfoVersion.instance.get_version rb_ver=SiSU_Env::InfoVersion.instance.rbversion if version[:version] - SiSU_Screen::Ansi.new('-v',version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version + opt_cmd=if defined? @color.cmd \ + and @color.cmd =~/[ck]/ + @color.cmd + else '-v' + end + SiSU_Screen::Ansi.new(opt_cmd,version[:project],version[:version],version[:date_stamp],version[:date],rb_ver).version else puts 'SiSU version information not available' end end |