aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/options.rb')
-rw-r--r--lib/sisu/v3/options.rb50
1 files changed, 22 insertions, 28 deletions
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index 110ebd85..aabbd946 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -61,44 +61,37 @@ module SiSU_commandline
require "pathname"
require_relative 'sysenv' # sysenv.rb
class Options
- attr_accessor :cmd,:mod,:act,:f_pths,:files,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what
+ attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what
def initialize(a)
- @a=a
+ @x=a
@cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng='','','','','','','','','',''
@f_pths,@files,@paths,@mod,@act=Array.new(5){[]}
@env=SiSU_Env::Info_env.new
+ @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by?
r=Px[:lng_lst].join('|')
- #r.gsub!(/\|en\|/,'|')
+ r.gsub!(/\|en\|/,'|')
@lang_regx=%r{(?:#{r})}
- if a.inspect =~/"(?:-\S|--\S+?)"/ \
- and a.inspect =~/"#{@lang_regx}"/ \
- and a.inspect =~/"en\/\S+?\.ss[tm]"/
- init_po
+ @a=if a.inspect =~/"(?:-\S+?|--\S+?)"/ \
+ && a.inspect =~/"#{@lang_regx}\/?"/ \
+ && a.inspect =~/"en\/\S+?\.ss[tm]"/
+ init_selected_lang_dirs(a)
+ else @x
end
+ @a.freeze
init
end
- def init_po
- a=@a
- if a.inspect =~/"(?:-\S|--\S+?)"/ \
- and a.inspect =~/"#{@lang_regx}"/ \
- and a.inspect =~/"en\/\S+?\.ss[tm]"/
- x,z=[],[]
- l=nil
- a.each do |y|
- if y =~/^(?:-\S|--\S+?)$/
- x << y
- elsif y =~/^en\/(\S+?\.ss[tm])$/
- l=$1
- x << y
- elsif y =~/^#{@lang_regx}$/
- z = x.dup
- z << y + '/' + l
- SiSU_commandline::Options.new(z)
- z=[]
- end
+ def init_selected_lang_dirs(a)
+ @z=[]
+ a.each do |y|
+ if y =~/^en\/(\S+?\.ss[tm])$/
+ @fn=$1
+ @z << y
+ elsif y =~/^#{@lang_regx}\/?$/
+ @z << "#{y}/#{@fn}"
+ else @z << y
end
end
- self
+ @z
end
def init
a=@a
@@ -413,7 +406,8 @@ module SiSU_commandline
true
else false
end
- act[:po4a]=if mod.inspect =~/"--po4a"|"--po"/
+ act[:po4a]=if cmd =~/P/ \
+ or mod.inspect =~/"--po4a"|"--pot?"/
true
else false
end