diff options
Diffstat (limited to 'lib/sisu/v5/options.rb')
| -rw-r--r-- | lib/sisu/v5/options.rb | 179 | 
1 files changed, 139 insertions, 40 deletions
| diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb index 422762d1..6f23d5a1 100644 --- a/lib/sisu/v5/options.rb +++ b/lib/sisu/v5/options.rb @@ -630,38 +630,6 @@ module SiSU_Commandline          else            { bool: false, set: :na, inst: nil }          end -        act[:verbose]=(cmd =~/v/ \ -        || mod.inspect =~/"--verbose"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:version_info]=(cmd =~/[vVM]/ \ -        || mod.inspect =~/"--verbose"|"--maintenance"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:quiet]=(cmd =~/q/ \ -        || mod.inspect =~/"--quiet"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ -          { bool: true, set: :on } -        elsif (cmd =~/k/ \ -        || mod.inspect =~/"--color-off"/) -          { bool: false, set: :off } -        else { bool: true, set: :na } #fix default color -        end -#       act[:color_toggle]=if cmd =~/c/ \ -#       or mod.inspect =~/"--color-toggle"/ -#         true -#       else false -#       end -        act[:maintenance]=(cmd =~/M/ \ -        || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na } -        act[:profile]=(cmd =~/E/ \ -        || mod.inspect =~/"--profile"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na }          act[:switch]=if mod.inspect =~/"--switch-off=/            off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')            off_list=off_list.scan(/[^,;\s]+/) @@ -806,10 +774,6 @@ module SiSU_Commandline            { bool: false, set: :off }          else { bool: true, set: :na }          end -        act[:dal]=(cmd =~/m/ \ -        || mod.inspect =~/"--dal"/) \ -        ? { bool: true, set: :on } -        : { bool: false, set: :na }          act[:html]=if (cmd =~/h/ \          || mod.inspect =~/"--html"/)            act[:html_scroll]={ bool: true, set: :on } @@ -978,7 +942,7 @@ module SiSU_Commandline          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:rsync]=(cmd =~/R/ \ -        || mod.inspect =~/"--rsync"/) \ +        || mod.inspect =~/"--rsync"|"--remote"/) \          ? { bool: true, set: :on }          : { bool: false, set: :na }          act[:zap]=(cmd =~/Z/ \ @@ -1004,6 +968,141 @@ module SiSU_Commandline          act[:help]=(mod.inspect =~/"--help/) \          ? { bool: true, set: :on }          : { bool: false, set: :na } +        act[:dal]=if (cmd =~/m/ \ +        || mod.inspect =~/"--dal"/) +          { bool: true, set: :on } +        elsif (act[:txt][:set]==:on \ +        || act[:xhtml][:set]==:on \ +        || act[:epub][:set]==:on \ +        || act[:html][:set]==:on \ +        || act[:html_seg][:set]==:on \ +        || act[:html_scroll][:set]==:on \ +        || act[:texinfo][:set]==:on \ +        || act[:manpage][:set]==:on \ +        || act[:hash_digests][:set]==:on \ +        || act[:odt][:set]==:on \ +        || act[:pdf][:set]==:on \ +        || act[:pdf_p][:set]==:on \ +        || act[:pdf_l][:set]==:on \ +        || act[:qrcode][:set]==:on \ +        || act[:share_source][:set]==:on \ +        || act[:sisupod][:set]==:on \ +        || act[:concordance][:set]==:on \ +        || act[:xml_dom][:set]==:on \ +        || act[:xml_sax][:set]==:on ) +          { bool: true, set: :on } +          #if cmd !~/[mn]/ +          #  extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \ +          #  and cmd !~/[mn]/ +          #    'm'                        #% add dal +        #elsif (act[:txt][:set]==:on \ +        #  { bool: true, set: :on } +          #  elsif ((cmd =~/[Dd]/ \ +          #  or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \ +          #  and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \ +          #  and cmd !~/[mn]/ +          #    'm'                        #% add dal +        else +          { bool: false, set: :na } +        end +        act[:manifest]=if mod.inspect =~/"--inc-manifest"/ +          { bool: true, set: :on } +        elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \ +        || act[:switch][:off].inspect =~/"manifest"/ +          { bool: false, set: :off } +        elsif (cmd =~/y/ \ +        || mod.inspect =~/"--manifest"/) +          { bool: true, set: :on } +        elsif (act[:txt][:set]==:on \ +        || act[:xhtml][:set]==:on \ +        || act[:epub][:set]==:on \ +        || act[:html][:set]==:on \ +        || act[:html_seg][:set]==:on \ +        || act[:html_scroll][:set]==:on \ +        || act[:texinfo][:set]==:on \ +        || act[:manpage][:set]==:on \ +        || act[:hash_digests][:set]==:on \ +        || act[:odt][:set]==:on \ +        || act[:pdf][:set]==:on \ +        || act[:pdf_p][:set]==:on \ +        || act[:pdf_l][:set]==:on \ +        || act[:qrcode][:set]==:on \ +        || act[:share_source][:set]==:on \ +        || act[:sisupod][:set]==:on \ +        || act[:concordance][:set]==:on \ +        || act[:xml_dom][:set]==:on \ +        || act[:xml_sax][:set]==:on ) +          { bool: true, set: :on } +          ##      if cmd !~/y/ +          ##        extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \ +          ##        and cmd !~/y/ +          ##          'ym'                       #% add manifest +        #elsif (act[:txt][:set]==:on \ +        #  { bool: true, set: :on } +           #        elsif (cmd =~/[Dd]/ \ +           #        or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \ +           #        and files[0] !~/^remove$/ \ +           #        and cmd !~/y/ +           #          'ym'                       #% add manifest +        else { bool: true, set: :na } +        end +        act[:console_messages] = '' +        act[:verbose]=if (cmd =~/v/ \ +        || mod.inspect =~/"--verbose"/) +          act[:console_messages] << ' --verbose ' +          { bool: true, set: :on } +        else +          { bool: false, set: :na } +        end +        act[:verbose_plus]=if (cmd =~/V/ \ +        || mod.inspect =~/"--very-verbose"/) +          act[:console_messages] << ' --very-verbose ' +          { bool: true, set: :on } +        else +          { bool: false, set: :na } +        end +        act[:version_info]=if (cmd =~/[vVM]/ \ +        || mod.inspect =~/"--verbose"|"--maintenance"/) +          act[:console_messages] << ' --maintenance ' +          { bool: true, set: :on } +        else +          { bool: false, set: :na } +        end +        act[:quiet]=if (cmd =~/q/ \ +        || mod.inspect =~/"--quiet"/) +          act[:console_messages] << ' --quiet ' +          { bool: true, set: :on } +        else +          { bool: false, set: :na } +        end +        act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ +          act[:console_messages] << ' --color-on ' +          { bool: true, set: :on } +        elsif (cmd =~/k/ \ +        || mod.inspect =~/"--color-off"/) +          act[:console_messages] << ' --color-off ' +          { bool: false, set: :off } +        else { bool: true, set: :na } #fix default color +        end +#       act[:color_toggle]=if cmd =~/c/ \ +#       or mod.inspect =~/"--color-toggle"/ +#         true +#       else false +#       end +        act[:maintenance]=if (cmd =~/M/ \ +        || mod.inspect =~/"--maintenance|--keep-processing-files"/) +          act[:console_messages] << ' --maintenance ' +          { bool: true, set: :on } +        else +          { bool: false, set: :na } +        end +        act[:profile]=if (cmd =~/E/ \ +        || mod.inspect =~/"--profile"/) +          act[:console_messages] << ' --color-off ' +          { bool: true, set: :on } +        else +          { bool: false, set: :na } +        end          @act=act        end      end @@ -1072,6 +1171,6 @@ module SiSU_Commandline    end  end  __END__ -note usually named @opt is carried in Param usually as @md @opt is a subset of -@md where @md is passed, contents of @opt are available as @md.opt passing @opt -as well is duplication check for fns & fnb +note usually named @opt is carried in Param (usually as @md.opt), @opt is a +subset of @md where @md is passed, contents of @opt are available as @md.opt +passing @opt as well is duplication check for fns & fnb | 
