diff options
Diffstat (limited to 'lib/sisu/v3/options.rb')
| -rw-r--r-- | lib/sisu/v3/options.rb | 39 | 
1 files changed, 24 insertions, 15 deletions
| diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 5b179a57..ac31a896 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,9 +62,9 @@ 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,:lng_base,:what +    attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:sub_location,: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,@lng_base,@base_path,@base_stub='','','','','','','','','','','','','' +      @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','',''        @f_pths,@files,@paths,@mod,@act=Array.new(5){[]}        @env=SiSU_Env::Info_env.new        @lng_base=@env.language_default_set @@ -197,12 +197,18 @@ module SiSU_commandline        a.uniq.each do |x|          if x =~/^-[a-z0-5]+/i \          or x =~/^--\S+/ -          if x =~/^-([a-z0-5]+)/i; c << $1 +          if x =~/^-([a-z0-5]+)/i +            c << $1            end -          if x =~/^--\S+/;        m << x +          if x =~/^--\S+/ +            m << x            end -        elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.zip|sisupod(\.zip)?)$/ -          if x =~/^(?:https?|file):\/\/\S+/;  f << x +        elsif x =~ /(?:\.(?:(?:-|ssm\.)?sst(?:\.xml)?|ssm|ssi|sx[sdn]\.xml|s[1-3]|kdi|ssp)|\S+?\.ss[mt]\.txz|sisupod(\.txz)?)$/ +          if x =~/^(?:https?|file):\/\/\S+/ \ +          or x =~/\S+?\.ss[mt]\.txz|sisupod\.txz/ \ +          && FileTest.file?(x) +            x=x.gsub(/^file:\/\//,'') +            f << x            elsif FileTest.file?(x)  ### FIX              pt=Pathname.new(x) @@ -212,7 +218,7 @@ module SiSU_commandline              u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/              t=/.+\/(#{r})$/              l_p = (pt.split[0].realpath.to_s[t,1]) \ -              ? pt.split[0].realpath.to_s[t,1] \ +              ? pt.split[0].realpath.to_s[t,1]                : nil                #: ''              lng << l_p @@ -233,7 +239,7 @@ module SiSU_commandline                f: pt.split[1].to_s,                pth_stub: pt.split[0].realpath.to_s[u,1],                lng: (pt.split[0].realpath.to_s[t,1]) \ -                ? pt.split[0].realpath.to_s[t,1] \ +                ? pt.split[0].realpath.to_s[t,1]                  : nil,                lng_is: lng_is              } @@ -257,31 +263,31 @@ module SiSU_commandline          y=case x          when /0/            (x=~/^-1\S+/) \ -          ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \ +          ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1')            : x.gsub(/^-0/,shortcut.cf_0 + ' ')          when /1/            (x=~/^-1\S+/) \ -          ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \ +          ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1')            : x.gsub(/^-1/,shortcut.cf_1 + ' ')          when /2/            (x=~/^-2\S+/) \ -          ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \ +          ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1')            : x.gsub(/^-2/,shortcut.cf_2 + ' ')          when /3/            (x=~/^-3\S+/) \ -          ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \ +          ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1')            : x.gsub(/^-3/,shortcut.cf_3 + ' ')          when /4/            (x=~/^-4\S+/) \ -          ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \ +          ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1')            : x.gsub(/^-4/,shortcut.cf_4 + ' ')          when /5/            (x=~/^-5\S+/) \ -          ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \ +          ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1')            : x.gsub(/^-5/,shortcut.cf_5 + ' ')          when /6/            (x=~/^-6\S+/) \ -          ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \ +          ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1')            : x.gsub(/^-6/,shortcut.cf_5 + ' ')          else x          end @@ -586,6 +592,9 @@ module SiSU_commandline      def pth        @pth      end +    def sub_location +      pth.gsub(/#{base_path}/,'') +    end      def lng        @lng      end | 
