aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4/options.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-12-28 12:25:17 -0500
committerRalph Amissah <ralph@amissah.com>2012-12-28 12:25:17 -0500
commita4e463e111ba498197315b8c6e5d882eb73be4a8 (patch)
tree893b67400a7fd540d1b15984d75bda50e8ec34bc /lib/sisu/v4/options.rb
parentv4 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/options.rb')
-rw-r--r--lib/sisu/v4/options.rb7
1 files changed, 5 insertions, 2 deletions
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