From bd2ba361e5a61ee4f1e24370b2e1bf24d10e7d41 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Aug 2011 23:49:51 -0400 Subject: v3: options, default action on running "sisu3 [filename.sst]", fix --- lib/sisu/v3/options.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/sisu/v3/options.rb') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index b5771590..6626870f 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -177,8 +177,10 @@ module SiSU_commandline @lngs = q[:lngs] if @files.length > 0 \ and @cmd.empty? \ - and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default - @cmd=shortcut.cf_0 + and @mod.length==0 #% if no other action called on filename given, default is sisu --v3 -0 [filename(s)] configured as flag default + shortcut=SiSU_Env::Info_processing_flag.new + @mod=['--v3'] + @cmd=shortcut.cf_0 + 'm' end SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ end -- cgit v1.2.3 From eb474533a94f2c10d74d771c2b782e101ee11e4c Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Aug 2011 23:54:45 -0400 Subject: v3: options, sysenv, sisurc.yml, set/config default language (code) * in absence of setting 'en' assumed * 'en' previously fixed --- lib/sisu/v3/options.rb | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'lib/sisu/v3/options.rb') diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 6626870f..5b179a57 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,11 +62,12 @@ module SiSU_commandline require_relative 'sysenv' # sysenv.rb @@base_path=nil class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what def initialize(a) - @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path,@base_stub='','','','','','','','','','','','' + @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub='','','','','','','','','','','','','' @f_pths,@files,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::Info_env.new + @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by? @@base_path ||=Dir.pwd @base_path=@@base_path @@ -134,7 +135,7 @@ module SiSU_commandline end end r=Px[:lng_lst].join('|') - r.gsub!(/\|en\|/,'|') + r.gsub!(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} z=if find_flag if f.length > 0 @@ -144,7 +145,7 @@ module SiSU_commandline end elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ && a.inspect =~/"#{@lang_regx}\/?"/ \ - && a.inspect =~/"en\/\S+?\.ss[tm]"/ + && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/ init_selected_lang_dirs(a) else b end @@ -154,7 +155,7 @@ module SiSU_commandline def init_selected_lang_dirs(a) @z=[] a.each do |y| - if y =~/^en\/(\S+?\.ss[tm])$/ + if y =~/^#{@lng_base}\/(\S+?\.ss[tm])$/ @fn=$1 @z << y elsif y =~/^#{@lang_regx}\/?$/ @@ -219,13 +220,13 @@ module SiSU_commandline l_p elsif x =~/~(#{r})\.ss[tm]/ $1 - else 'en' + else lng_base end lng_is =if l_p l_p elsif x =~/~(#{r})\.ss[tm]/ $1 - else 'en' + else lng_base end f_pths << { pth: pt.split[0].realpath.to_s, @@ -588,6 +589,9 @@ module SiSU_commandline def lng @lng end + def lng_base + @lng_base + end def fns @fns end -- cgit v1.2.3