diff options
-rw-r--r-- | data/doc/sisu/CHANGELOG_v4 | 11 | ||||
-rw-r--r-- | data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst | 12 | ||||
-rw-r--r-- | lib/sisu/v4/help.rb | 10 | ||||
-rw-r--r-- | lib/sisu/v4/hub.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v4/options.rb | 7 | ||||
-rw-r--r-- | lib/sisu/v4/screen_text_color.rb | 8 |
6 files changed, 40 insertions, 14 deletions
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4 index 51922303..6cbc23a1 100644 --- a/data/doc/sisu/CHANGELOG_v4 +++ b/data/doc/sisu/CHANGELOG_v4 @@ -28,6 +28,17 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.0.1.orig.tar.xz * v4: debug (internal code use), color markers for line number & file name (colored location markers to show when line passed within running code) +* v4: control color on/off to screen + close #622171 sisu: --color flag, which toggles color on/off + 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 + the fix here is specific to color on/off for reporting of sisu version + sisu -v -k + sisu --version --color-off + %% 4.0.0.orig.tar.xz (2012-12-12:50/3) http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.0.0 http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.0.0-1 diff --git a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst index 0f3c0b8e..2811e961 100644 --- a/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst +++ b/data/doc/sisu/markup-samples/v4/sisu_manual/sisu_commands.sst @@ -55,6 +55,15 @@ see --configure !_ -c [filename/wildcard] \\ see --color-toggle +!_ --color \\ +see --color-on + +!_ --color-off \\ +turn off color in output to terminal + +!_ --color-on \\ +turn on color in output to terminal + !_ --color-toggle [filename/wildcard] \\ screen toggle ansi screen colour on or off depending on default set (unless -c flag is used: if sisurc colour default is set to 'true', output to screen will be with colour, if sisurc colour default is set to 'false' or is undefined screen output will be without colour). Alias -c @@ -148,6 +157,9 @@ see --exc-* !_ -j [filename/wildcard] \\ copies images associated with a file for use by html, xhtml & xml outputs (automatically invoked by --dump & redirect). +!_ -k \\ +see --color-off + !_ --keep-processing-files [filename/wildcard/url] \\ see --maintenance 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 diff --git a/lib/sisu/v4/hub.rb b/lib/sisu/v4/hub.rb index da5b785e..1fb73a73 100644 --- a/lib/sisu/v4/hub.rb +++ b/lib/sisu/v4/hub.rb @@ -440,12 +440,6 @@ p "#{__LINE__}:#{__FILE__}" if @opt.act[:maintenance][:set] ==:on end SiSU::Operations.new.counter end - if @opt.cmd =~/k/ #% -k temporary tests - OptionLoopFiles.new(@opt).loop_files_on_given_option do - #require_relative 'xml_scaffold' - #fix - end - end if @opt.act[:psql][:set]==:on #% --pg, -D DB postgresql require_relative 'dbi' if @opt.files.length > 0 #switch test to actual commands diff --git a/lib/sisu/v4/options.rb b/lib/sisu/v4/options.rb index b26bada2..9b9e1249 100644 --- a/lib/sisu/v4/options.rb +++ b/lib/sisu/v4/options.rb @@ -260,7 +260,7 @@ module SiSU_Commandline @cmd=shortcut.cf_0 + 'm' end if @cmd =~/[vVM]/ \ - && @cmd !~/-vu?$/ + && @cmd !~/-[ku]*v[ku]*$/ SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown end end @@ -466,6 +466,7 @@ module SiSU_Commandline m.each do |m| case m when /^--(?:color-toggle)$/; c=c+'c' + when /^--(?:color-off)$/; c=c+'k' when /^--(?:configure|init-site)$/; c=c+'CC' when /^--(?:dal?|machine|abstraction|abs)$/; c=c+'m' when /^--(?:txt|text|plaintext)$/; c=c+'t' @@ -501,6 +502,7 @@ module SiSU_Commandline when /^--(?:verbose[=-]3)$/; c=c+'VM' when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/; c=c+'V' when /^--(?:verbose(?:[=-]1)?)$/; c=c+'v' + when /^--(?:version)$/; c=c+'v' when /^--(?:verbose[=-]0|quiet|silent)$/; c=c+'q' else mod << m #mod only contains command modifiers; commands converted to character end @@ -609,7 +611,8 @@ module SiSU_Commandline : { bool: false, set: :na } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ { bool: true, set: :on } - elsif mod.inspect =~/"--color-off"/ + elsif (cmd =~/k/ \ + || mod.inspect =~/"--color-off"/) { bool: false, set: :off } else { bool: true, set: :na } #fix default color end diff --git a/lib/sisu/v4/screen_text_color.rb b/lib/sisu/v4/screen_text_color.rb index a9c0b367..1a4f87b9 100644 --- a/lib/sisu/v4/screen_text_color.rb +++ b/lib/sisu/v4/screen_text_color.rb @@ -68,12 +68,12 @@ module SiSU_Screen @cmd,@txt=cmd,txt @color_instruct=txt[0] flag=SiSU_Env::InfoProcessingFlag.new - if @cmd + if cmd #set default colors on or off -c acts as toggle against this default, if default is off -c turns on, if default is on -c turns off @use_color=(flag.color) \ - ? ((@cmd =~/c/) ? false : true) - : ((@cmd =~/c/) ? true : false) - if @cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future + ? ((cmd =~/c/) ? false : true) + : ((cmd =~/c/) ? true : false) + if cmd =~/k/ then @use_color=false # useful color off switch, however, k may be used for something else in future end else @use_color=false end |