diff options
Diffstat (limited to 'lib/sisu/v3dv/options.rb')
-rw-r--r-- | lib/sisu/v3dv/options.rb | 303 |
1 files changed, 177 insertions, 126 deletions
diff --git a/lib/sisu/v3dv/options.rb b/lib/sisu/v3dv/options.rb index b2b7ff15..44eb1020 100644 --- a/lib/sisu/v3dv/options.rb +++ b/lib/sisu/v3dv/options.rb @@ -435,47 +435,47 @@ module SiSU_Commandline act={} act[:license]=(cmd =~/L/ \ || mod.inspect =~/"--license/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:site_init]=(cmd =~/C/ \ || mod.inspect =~/"--init-site/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:rc]=if mod.inspect =~/"--rc=/ x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') - { bool: true, inst: x } + { bool: true, set: :on, inst: x } else - { bool: false, inst: '' } + { bool: false, set: :na, inst: '' } end act[:dump]=if mod.inspect =~/"--dump=/ base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, inst: base_pth } + { bool: true, set: :on, inst: base_pth } elsif mod.inspect =~/"--dump/ - { bool: true, inst: @base_path } + { bool: true, set: :on, inst: @base_path } else - { bool: false, inst: nil } + { bool: false, set: :na, inst: nil } end act[:redirect]=if mod.inspect =~/"--redirect=/ base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, inst: base_pth } + { bool: true, set: :on, inst: base_pth } elsif mod.inspect =~/"--redirect/ - { bool: true, inst: @base_path } + { bool: true, set: :on, inst: @base_path } else - { bool: false, inst: nil } + { bool: false, set: :na, inst: nil } end act[:verbose]=(cmd =~/v/ \ || mod.inspect =~/"--verbose"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:quiet]=(cmd =~/q/ \ || mod.inspect =~/"--quiet"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:color_state]=if mod.inspect =~/"--color-on"|"--color"/ - { bool: true } + { bool: true, set: :on } elsif mod.inspect =~/"--color-off"/ - { bool: false } - else { bool: true } #fix default color + { bool: false, set: :off } + else { bool: true, set: :na } #fix default color end # act[:color_toggle]=if cmd =~/c/ \ # or mod.inspect =~/"--color-toggle"/ @@ -484,202 +484,253 @@ module SiSU_Commandline # end act[:maintenance]=(cmd =~/M/ \ || mod.inspect =~/"--maintenance|--keep-processing-files"/) \ - ? { bool: true } - : { bool: false } + ? { 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]+/) - { bool: false, off: off_list} - else { bool: true, off: [] } + { bool: false, set: :off, off: off_list} + else { bool: true, set: :na, off: [] } end - act[:ocn]=if mod.inspect =~/"--no-ocn"/ \ + act[:ocn]= + if mod.inspect =~/"--inc-ocn"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \ || act[:switch][:off].inspect =~/"ocn"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:toc]=if mod.inspect =~/"--no-toc"/ \ + act[:toc]=if mod.inspect =~/"--inc-toc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-toc"/ \ || act[:switch][:off].inspect =~/"toc"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest]=if mod.inspect =~/"--no-manifest"/ \ + act[:minitoc]=if mod.inspect =~/"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \ + || act[:switch][:off].inspect =~/"minitoc"/ + { bool: false, set: :off } + else { bool: true, 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"/ - #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest_links]=if mod.inspect =~/"--no-manifest-links"/ \ - || act[:switch][:off].inspect =~/"manifest_links"/ \ + act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \ + || act[:switch][:off].inspect =~/"links_to_manifest"|"manifest_links"/ \ || mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:manifest_minitoc]=if mod.inspect =~/"--no-manifest-minitoc"/ \ + act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \ || act[:switch][:off].inspect =~/"manifest_minitoc"|"minitoc"/ #|| mod.inspect =~/"--(?:redirect|dump)/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:metadata]=if mod.inspect =~/"--no-metadata"/ \ + act[:metadata]=if mod.inspect =~/"--inc-metadata"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \ || act[:switch][:off].inspect =~/"metadata"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_minitoc]=if mod.inspect =~/"--no-html-minitoc"/ \ + act[:html_minitoc]=if mod.inspect =~/"--inc-html-minitoc"|"--inc-minitoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \ || act[:switch][:off].inspect =~/"html_minitoc"|"minitoc"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_navigation]=if mod.inspect =~/"--no-html-navigation"/ \ + act[:html_navigation]=if mod.inspect =~/"--inc-html-navigation"|"--inc-navigation"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \ || act[:switch][:off].inspect =~/"html_navigation"|"nav"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_navigation_bar]=if mod.inspect =~/"--no-html-navigation-bar"/ \ + act[:html_navigation_bar]=if mod.inspect =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \ || act[:switch][:off].inspect =~/"html_navigation_bar"|"navbar"/ - { bool: false } - else { bool: true } + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:segsubtoc]=if mod.inspect =~/"--inc-segsubtoc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \ + || act[:switch][:off].inspect =~/"segsubtoc"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:search_form]=if mod.inspect =~/"--inc-search-form"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \ + || act[:switch][:off].inspect =~/"search_form"|"search"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:html_search_form]=if mod.inspect =~/"--inc-html-search-form"|"--inc-search-form"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-search-form"|"--(?:exc|no)-search-form"/ \ + || act[:switch][:off].inspect =~/"html_search_form"|"search_form"|"search"/ + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_search_form]=if mod.inspect =~/"--no-html-search-form"/ \ - || act[:switch][:off].inspect =~/"html_search_form"|"search"/ - { bool: false } - else { bool: true } + act[:html_right_pane]=if mod.inspect =~/"--inc-html-right-pane"|"--inc-right-pane"|"--inc-html-right-column"|"--inc-right-column"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-right-pane"|"--(?:exc|no)-right-pane"|"--(?:exc|no)-html-right-column"|"--(?:exc|no)-right-column"/ \ + || act[:switch][:off].inspect =~/"html_right_pane"|"html_right_column"|"promo"/ + { bool: false, set: :off } + else { bool: true, set: :na } end - act[:html_right_column]=if mod.inspect =~/"--no-html-right-column"/ \ - || act[:switch][:off].inspect =~/"html_right_column"|"promo"/ - { bool: false } - else { bool: true } + act[:html_top_band]=if mod.inspect =~/"--inc-html-top-band"|"--inc-top-band"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \ + || act[:switch][:off].inspect =~/"html-top-band"|"top-band"/ + { bool: false, set: :off } + else { bool: true, set: :na } end act[:dal]=(cmd =~/m/ \ || mod.inspect =~/"--dal"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:html]=(cmd =~/h/ \ || mod.inspect =~/"--html"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:concordance]=(cmd =~/w/ \ || mod.inspect =~/"--concordance"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:images]=(cmd =~/j/ \ || mod.inspect =~/"--images"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:pdf]=(cmd =~/p/ \ || mod.inspect =~/"--pdf"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:epub]=(cmd =~/e/ \ || mod.inspect =~/"--epub"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:odt]=(cmd =~/o/ \ || mod.inspect =~/"--odf"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_sax]=(cmd =~/x/ \ || mod.inspect =~/"--xml-sax"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xml_dom]=(cmd =~/X/ \ || mod.inspect =~/"--xml-dom"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:xhtml]=(cmd =~/b/ \ || mod.inspect =~/"--xhtml"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:txt]=(cmd =~/[at]/ \ || mod.inspect =~/"--txt"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:manpage]=(cmd =~/i/ \ || mod.inspect =~/"--manpage"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:texinfo]=(cmd =~/I/ \ || mod.inspect =~/"--texinfo"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:fictionbook]=(cmd =~/f/ \ || mod.inspect =~/"--fictionbook"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:psql]=(cmd =~/D/ \ || mod.inspect =~/"--pg"|"--pgsql"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sqlite]=(cmd =~/d/ \ || mod.inspect =~/"--sqlite"/) \ - ? { bool: true } - : { bool: false } + && (mod.inspect =~/"--createdb"|"--create"|"--recreate"|"--dropall"|"--recreate"|"--import"|"--update"|"--remove"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:harvest]=(mod.inspect =~/"--harvest"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:po4a]=(cmd =~/P/ \ || mod.inspect =~/"--po4a"|"--pot?"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:git]=(cmd =~/g/ \ || mod.inspect =~/"--git"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:hash_digests]=(cmd =~/N/ \ || mod.inspect =~/"--hash-digests"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sample_search_form]=(cmd =~/F/ \ || mod.inspect =~/"--sample-search-form"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:webrick]=(cmd =~/W/ \ || mod.inspect =~/"--webrick"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:share_source]=(cmd =~/s/ \ || mod.inspect =~/"--source"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sisupod]=(cmd =~/S/ \ || mod.inspect =~/"--sisupod"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:scp]=(cmd =~/r/ \ || mod.inspect =~/"--scp"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:rsync]=(cmd =~/R/ \ || mod.inspect =~/"--rsync"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:delete_output]=(cmd =~/z/ \ || mod.inspect =~/"--delete"|"--zap"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:urls_all]=(cmd =~/U/ \ || mod.inspect =~/"--urls-all"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:urls_seleted]=(cmd =~/u/ \ || mod.inspect =~/"--urls"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:sitemap]=(cmd =~/Y/ \ || mod.inspect =~/"--sitemap"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:qrcode]=(cmd =~/Q/ \ || mod.inspect =~/"--qrcode"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:manifest]=(cmd =~/y/ \ || mod.inspect =~/"--manifest"/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } act[:help]=(mod.inspect =~/"--help/) \ - ? { bool: true } - : { bool: false } + ? { bool: true, set: :on } + : { bool: false, set: :na } @act=act end def cmd |