diff options
Diffstat (limited to 'lib/sisu/v3/options.rb')
| -rw-r--r-- | lib/sisu/v3/options.rb | 347 | 
1 files changed, 158 insertions, 189 deletions
| diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index dbfe5d79..66866dc3 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -375,204 +375,173 @@ module SiSU_commandline      def opt_act #note mod line commands have already been converted to command characters, cmd        cmd,mod=@cmd,@mod        act={} -      act[:license]=if cmd =~/L/ \ -      or mod.inspect =~/"--license/ -        true -      else false -      end -      act[:site_init]=if cmd =~/C/ \ -      or mod.inspect =~/"--init-site/ -        true -      else false -      end -      act[:verbose]=if cmd =~/v/ \ -      or mod.inspect =~/"--verbose"/ -        true -      else false -      end -      act[:quiet]=if cmd =~/q/ \ -      or mod.inspect =~/"--quiet"/ -        true -      else false -      end +      act[:license]=(cmd =~/L/ \ +      || mod.inspect =~/"--license/) \ +      ? { bool: true } +      : { bool: false } +      act[:site_init]=(cmd =~/C/ \ +      || mod.inspect =~/"--init-site/) \ +      ? { bool: true } +      : { bool: false } +      act[:rc]=if mod.inspect =~/"--rc=/ +        x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') +        { bool: true, inst: x  } +      else +        { bool: false, inst: '' } +      end +      act[:verbose]=(cmd =~/v/ \ +      || mod.inspect =~/"--verbose"/) \ +      ? { bool: true } +      : { bool: false } +      act[:quiet]=(cmd =~/q/ \ +      || mod.inspect =~/"--quiet"/) \ +      ? { bool: true } +      : { bool: false }        act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ -        true +        { bool: true }        elsif mod.inspect =~/"--color-off"/ -        true -      else true #fix default color +        { bool: false } +      else { bool: true } #fix default color        end  #     act[:color_toggle]=if cmd =~/c/ \  #     or mod.inspect =~/"--color-toggle"/  #       true  #     else false  #     end -      act[:maintenance]=if cmd =~/M/ \ -      or mod.inspect =~/"--maintenance|--keep-processing-files"/ -        true -      else false -      end +      act[:maintenance]=(cmd =~/M/ \ +      || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ +      ? { bool: true } +      : { bool: false }        act[:ocn]=if mod.inspect =~/"--no-ocn"/ -        false -      else true -      end -      act[:dal]=if cmd =~/m/ \ -      or mod.inspect =~/"--dal"/ -        true -      else false -      end -      act[:html]=if cmd =~/h/ \ -      or mod.inspect =~/"--html"/ -        true -      else false -      end -      act[:concordance]=if cmd =~/w/ \ -      or mod.inspect =~/"--concordance"/ -        true -      else false -      end -      act[:pdf]=if cmd =~/p/ \ -      or mod.inspect =~/"--pdf"/ -        true -      else false -      end -      act[:epub]=if cmd =~/e/ \ -      or mod.inspect =~/"--epub"/ -        true -      else false -      end -      act[:odt]=if cmd =~/o/ \ -      or mod.inspect =~/"--odf"/ -        true -      else false -      end -      act[:xml_sax]=if cmd =~/x/ \ -      or mod.inspect =~/"--xml-sax"/ -        true -      else false -      end -      act[:xml_dom]=if cmd =~/X/ \ -      or mod.inspect =~/"--xml-dom"/ -        true -      else false -      end -      act[:xhtml]=if cmd =~/b/ \ -      or mod.inspect =~/"--xhtml"/ -        true -      else false -      end -      act[:txt]=if cmd =~/[at]/ \ -      or mod.inspect =~/"--txt"/ -        true -      else false -      end -      act[:manpage]=if cmd =~/i/ \ -      or mod.inspect =~/"--manpage"/ -        true -      else false -      end -      act[:texinfo]=if cmd =~/I/ \ -      or mod.inspect =~/"--texinfo"/ -        true -      else false -      end -      act[:fictionbook]=if cmd =~/f/ \ -      or mod.inspect =~/"--fictionbook"/ -        true -      else false -      end -      act[:psql]=if cmd =~/D/ \ -      or mod.inspect =~/"--pg"|"--pgsql"/ -        true -      else false -      end -      act[:sqlite]=if cmd =~/d/ \ -      or mod.inspect =~/"--sqlite"/ -        true -      else false -      end -      act[:harvest]=if mod.inspect =~/"--harvest"/ -        true -      else false -      end -      act[:po4a]=if cmd =~/P/ \ -      or mod.inspect =~/"--po4a"|"--pot?"/ -        true -      else false -      end -      act[:git]=if cmd =~/g/ \ -      or mod.inspect =~/"--git"/ -        true -      else false -      end -      act[:hash_digests]=if cmd =~/N/ \ -      or mod.inspect =~/"--hash-digests"/ -        true -      else false -      end -      act[:sample_search_form]=if cmd =~/F/ \ -      or mod.inspect =~/"--sample-search-form"/ -        true -      else false -      end -      act[:webrick]=if cmd =~/W/ \ -      or mod.inspect =~/"--webrick"/ -        true -      else false -      end -      act[:share_source]=if cmd =~/s/ \ -      or mod.inspect =~/"--source"/ -        true -      else false -      end -      act[:sisupod]=if cmd =~/S/ \ -      or mod.inspect =~/"--sisupod"/ -        true -      else false -      end -      act[:scp]=if cmd =~/r/ \ -      or mod.inspect =~/"--scp"/ -        true -      else false -      end -      act[:rsync]=if cmd =~/R/ \ -      or mod.inspect =~/"--rsync"/ -        true -      else false -      end -      act[:delete_output]=if cmd =~/z/ \ -      or mod.inspect =~/"--delete"|"--zap"/ -        true -      else false -      end -      act[:urls_all]=if cmd =~/U/ \ -      or mod.inspect =~/"--urls-all"/ -        true -      else false -      end -      act[:urls_seleted]=if cmd =~/u/ \ -      or mod.inspect =~/"--urls"/ -        true -      else false -      end -      act[:sitemap]=if cmd =~/Y/ \ -      or mod.inspect =~/"--sitemap"/ -        true -      else false -      end -      act[:qrcode]=if cmd =~/Q/ \ -      or mod.inspect =~/"--qrcode"/ -        true -      else false -      end -      act[:manifest]=if cmd =~/y/ \ -      or mod.inspect =~/"--manifest"/ -        true -      else false -      end -      act[:help]=if mod.inspect =~/"--help/ -        true -      else false -      end +         { bool: false } +      else { bool: true } +      end +      act[:dal]=(cmd =~/m/ \ +      || mod.inspect =~/"--dal"/) \ +      ? { bool: true } +      : { bool: false } +      act[:html]=(cmd =~/h/ \ +      || mod.inspect =~/"--html"/) \ +      ? { bool: true } +      : { bool: false } +      act[:concordance]=(cmd =~/w/ \ +      || mod.inspect =~/"--concordance"/) \ +      ? { bool: true } +      : { bool: false } +      act[:pdf]=(cmd =~/p/ \ +      || mod.inspect =~/"--pdf"/) \ +      ? { bool: true } +      : { bool: false } +      act[:epub]=(cmd =~/e/ \ +      || mod.inspect =~/"--epub"/) \ +      ? { bool: true } +      : { bool: false } +      act[:odt]=(cmd =~/o/ \ +      || mod.inspect =~/"--odf"/) \ +      ? { bool: true } +      : { bool: false } +      act[:xml_sax]=(cmd =~/x/ \ +      || mod.inspect =~/"--xml-sax"/) \ +      ? { bool: true } +      : { bool: false } +      act[:xml_dom]=(cmd =~/X/ \ +      || mod.inspect =~/"--xml-dom"/) \ +      ? { bool: true } +      : { bool: false } +      act[:xhtml]=(cmd =~/b/ \ +      || mod.inspect =~/"--xhtml"/) \ +      ? { bool: true } +      : { bool: false } +      act[:txt]=(cmd =~/[at]/ \ +      || mod.inspect =~/"--txt"/) \ +      ? { bool: true } +      : { bool: false } +      act[:manpage]=(cmd =~/i/ \ +      || mod.inspect =~/"--manpage"/) \ +      ? { bool: true } +      : { bool: false } +      act[:texinfo]=(cmd =~/I/ \ +      || mod.inspect =~/"--texinfo"/) \ +      ? { bool: true } +      : { bool: false } +      act[:fictionbook]=(cmd =~/f/ \ +      || mod.inspect =~/"--fictionbook"/) \ +      ? { bool: true } +      : { bool: false } +      act[:psql]=(cmd =~/D/ \ +      || mod.inspect =~/"--pg"|"--pgsql"/) \ +      ? { bool: true } +      : { bool: false } +      act[:sqlite]=(cmd =~/d/ \ +      || mod.inspect =~/"--sqlite"/) \ +      ? { bool: true } +      : { bool: false } +      act[:harvest]=(mod.inspect =~/"--harvest"/) \ +      ? { bool: true } +      : { bool: false } +      act[:po4a]=(cmd =~/P/ \ +      || mod.inspect =~/"--po4a"|"--pot?"/) \ +      ? { bool: true } +      : { bool: false } +      act[:git]=(cmd =~/g/ \ +      || mod.inspect =~/"--git"/) \ +      ? { bool: true } +      : { bool: false } +      act[:hash_digests]=(cmd =~/N/ \ +      || mod.inspect =~/"--hash-digests"/) \ +      ? { bool: true } +      : { bool: false } +      act[:sample_search_form]=(cmd =~/F/ \ +      || mod.inspect =~/"--sample-search-form"/) \ +      ? { bool: true } +      : { bool: false } +      act[:webrick]=(cmd =~/W/ \ +      || mod.inspect =~/"--webrick"/) \ +      ? { bool: true } +      : { bool: false } +      act[:share_source]=(cmd =~/s/ \ +      || mod.inspect =~/"--source"/) \ +      ? { bool: true } +      : { bool: false } +      act[:sisupod]=(cmd =~/S/ \ +      || mod.inspect =~/"--sisupod"/) \ +      ? { bool: true } +      : { bool: false } +      act[:scp]=(cmd =~/r/ \ +      || mod.inspect =~/"--scp"/) \ +      ? { bool: true } +      : { bool: false } +      act[:rsync]=(cmd =~/R/ \ +      || mod.inspect =~/"--rsync"/) \ +      ? { bool: true } +      : { bool: false } +      act[:delete_output]=(cmd =~/z/ \ +      || mod.inspect =~/"--delete"|"--zap"/) \ +      ? { bool: true } +      : { bool: false } +      act[:urls_all]=(cmd =~/U/ \ +      || mod.inspect =~/"--urls-all"/) \ +      ? { bool: true } +      : { bool: false } +      act[:urls_seleted]=(cmd =~/u/ \ +      || mod.inspect =~/"--urls"/) \ +      ? { bool: true } +      : { bool: false } +      act[:sitemap]=(cmd =~/Y/ \ +      || mod.inspect =~/"--sitemap"/) \ +      ? { bool: true } +      : { bool: false } +      act[:qrcode]=(cmd =~/Q/ \ +      || mod.inspect =~/"--qrcode"/) \ +      ? { bool: true } +      : { bool: false } +      act[:manifest]=(cmd =~/y/ \ +      || mod.inspect =~/"--manifest"/) \ +      ? { bool: true } +      : { bool: false } +      act[:help]=(mod.inspect =~/"--help/) \ +      ? { bool: true } +      : { bool: false }        @act=act      end      def cmd | 
