diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/options.rb | 682 |
1 files changed, 344 insertions, 338 deletions
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 5871d8db..ba2864fd 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,6 +62,7 @@ module SiSU_Commandline @@base_path=nil class Options attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what + @@act=nil def initialize(a) @cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','','' @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]} @@ -185,10 +186,13 @@ module SiSU_Commandline @mod=['--v3'] @cmd=shortcut.cf_0 + 'm' end - SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/ + if @cmd =~/[vVM]/ \ + && @cmd !~/-vu?$/ + SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown + end end # @files=@files.uniq - @act=opt_act + @@act ? @act=@@act : @@act=@act=opt_act @files self end @@ -315,9 +319,9 @@ module SiSU_Commandline else puts "file not found: #{x}" end elsif x =~ /\.termsheet\.rb$/ - if FileTest.file?(x); f << x - else puts "file not found: #{x}" - end + (FileTest.file?(x)) \ + ? (f << x) + : (puts "file not found: #{x}") else w=x puts "#{x} in #{a.join(' ')}?" end @@ -456,340 +460,342 @@ module SiSU_Commandline end def opt_act #note mod line commands have already been converted to command characters, cmd cmd,mod=@cmd,@mod - act={} - act[:license]=(cmd =~/L/ \ - || mod.inspect =~/"--license/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:site_init]=(cmd =~/C/ \ - || mod.inspect =~/"--init-site"|"--configure"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:rc]=if mod.inspect =~/"--rc=/ - x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') - { bool: true, set: :on, inst: x } - else - { bool: false, set: :na, inst: '' } - end - act[:processing_path]=if mod.inspect =~/"--processing-path=/ - base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, set: :on, inst: base_pth } - elsif mod.inspect =~/"--processing-path/ - { bool: true, set: :on, inst: @base_path } - else - { bool: false, set: :na, inst: nil } - end - act[:dump]=if mod.inspect =~/"--dump=/ - base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, set: :on, inst: base_pth } - elsif mod.inspect =~/"--dump/ - { bool: true, set: :on, inst: @base_path } + @@act=if @@act + @act=@@act else - { bool: false, set: :na, inst: nil } - end - act[:redirect]=if mod.inspect =~/"--redirect=/ - base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') - { bool: true, set: :on, inst: base_pth } - elsif mod.inspect =~/"--redirect/ - { bool: true, set: :on, inst: @base_path } - else - { bool: false, set: :na, inst: nil } - end - act[:verbose]=(cmd =~/v/ \ - || mod.inspect =~/"--verbose"/) \ - ? { 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 mod.inspect =~/"--color-off"/ - { bool: false, set: :off } - else { bool: true, set: :na } #fix default color - end - act[:version_info]=if cmd =~/[vVM]/ \ - || mod.inspect =~/"--verbose"|"--maintenance"/ - { bool: true, set: :on } - else - { bool: false, set: :na } - 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]+/) - { bool: false, set: :off, off: off_list} - else { bool: true, set: :na, off: [] } - end - act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/ - { set: :language } - elsif mod.inspect =~/"--(?:output-)?by-filename"/ - { set: :filename } - elsif mod.inspect =~/"--(?:output-)?by-filetype"/ - { set: :filetype } - else { set: :na } - end - act[:ocn]=if mod.inspect =~/"--inc-ocn"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \ - || act[:switch][:off].inspect =~/"ocn"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - act[:toc]=if mod.inspect =~/"--inc-toc"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-toc"/ \ - || act[:switch][:off].inspect =~/"toc"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - 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"/ - { bool: false, set: :off } - elsif act[:manifest]=(cmd =~/y/ \ - || mod.inspect =~/"--manifest"/) - { bool: true, set: :on } - else { bool: true, set: :na } - end - 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"|"--(?:exc|no)-manifest"/ \ - || mod.inspect =~/"--(?:redirect|dump)/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - 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, set: :off } - else { bool: true, set: :na } - end - act[:metadata]=if mod.inspect =~/"--inc-metadata"/ - { bool: true, set: :on } - elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \ - || act[:switch][:off].inspect =~/"metadata"/ - { bool: false, set: :off } - else { bool: true, set: :na } - end - 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, set: :off } - else { bool: true, set: :na } - end - 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, set: :off } - else { bool: true, set: :na } - end - 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, 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_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_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 } + act={} + act[:license]=(cmd =~/L/ \ + || mod.inspect =~/"--license/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:site_init]=(cmd =~/C/ \ + || mod.inspect =~/"--init-site"|"--configure"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:rc]=if mod.inspect =~/"--rc=/ + x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'') + { bool: true, set: :on, inst: x } + else + { bool: false, set: :na, inst: '' } + end + act[:processing_path]=if mod.inspect =~/"--processing-path=/ + base_pth=mod.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1') + { bool: true, set: :on, inst: base_pth } + elsif mod.inspect =~/"--processing-path/ + { bool: true, set: :on, inst: @base_path } + else + { bool: false, set: :na, inst: nil } + end + act[:dump]=if mod.inspect =~/"--dump=/ + base_pth=mod.join(';').gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1') + { bool: true, set: :on, inst: base_pth } + elsif mod.inspect =~/"--dump/ + { bool: true, set: :on, inst: @base_path } + else + { bool: false, set: :na, inst: nil } + end + act[:redirect]=if mod.inspect =~/"--redirect=/ + base_pth=mod.join(';').gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1') + { bool: true, set: :on, inst: base_pth } + elsif mod.inspect =~/"--redirect/ + { bool: true, set: :on, inst: @base_path } + 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 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]+/) + { bool: false, set: :off, off: off_list} + else { bool: true, set: :na, off: [] } + end + act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/ + { set: :language } + elsif mod.inspect =~/"--(?:output-)?by-filename"/ + { set: :filename } + elsif mod.inspect =~/"--(?:output-)?by-filetype"/ + { set: :filetype } + else { set: :na } + end + act[:ocn]=if mod.inspect =~/"--inc-ocn"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \ + || act[:switch][:off].inspect =~/"ocn"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + act[:toc]=if mod.inspect =~/"--inc-toc"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-toc"/ \ + || act[:switch][:off].inspect =~/"toc"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + 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"/ + { bool: false, set: :off } + elsif act[:manifest]=(cmd =~/y/ \ + || mod.inspect =~/"--manifest"/) + { bool: true, set: :on } + else { bool: true, set: :na } + end + 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"|"--(?:exc|no)-manifest"/ \ + || mod.inspect =~/"--(?:redirect|dump)/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + 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, set: :off } + else { bool: true, set: :na } + end + act[:metadata]=if mod.inspect =~/"--inc-metadata"/ + { bool: true, set: :on } + elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \ + || act[:switch][:off].inspect =~/"metadata"/ + { bool: false, set: :off } + else { bool: true, set: :na } + end + 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, set: :off } + else { bool: true, set: :na } + end + 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, set: :off } + else { bool: true, set: :na } + end + 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, 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_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_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, set: :on } + : { bool: false, set: :na } + act[:html]=(cmd =~/h/ \ + || mod.inspect =~/"--html"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:concordance]=(cmd =~/w/ \ + || mod.inspect =~/"--concordance"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:images]=(cmd =~/j/ \ + || mod.inspect =~/"--images"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:pdf]=(cmd =~/p/ \ + || mod.inspect =~/"--pdf"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:epub]=(cmd =~/e/ \ + || mod.inspect =~/"--epub"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:odt]=(cmd =~/o/ \ + || mod.inspect =~/"--odt"|"--odf"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:xml_sax]=(cmd =~/x/ \ + || mod.inspect =~/"--xml-sax"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:xml_dom]=(cmd =~/X/ \ + || mod.inspect =~/"--xml-dom"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:xhtml]=(cmd =~/b/ \ + || mod.inspect =~/"--xhtml"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:txt]=(cmd =~/[at]/ \ + || mod.inspect =~/"--txt"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:manpage]=(cmd =~/i/ \ + || mod.inspect =~/"--manpage"|"--man"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:texinfo]=(cmd =~/I/ \ + || mod.inspect =~/"--texinfo"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:fictionbook]=(cmd =~/f/ \ + || mod.inspect =~/"--fictionbook"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:psql]=(cmd =~/D/ \ + || mod.inspect =~/"--pg"|"--pgsql"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:sqlite]=(cmd =~/d/ \ + || mod.inspect =~/"--sqlite"/) \ + && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:sqlite_discreet]=(cmd =~/d/ \ + || mod.inspect =~/"--sql"|"--sqlite"/) \ + && (mod.inspect =~/"--both"/ \ + || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:harvest]=(mod.inspect =~/"--harvest"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:po4a]=(cmd =~/P/ \ + || mod.inspect =~/"--po4a"|"--pot?"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:git]=(cmd =~/g/ \ + || mod.inspect =~/"--git"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:zap]=(cmd =~/Z/ \ + || mod.inspect =~/"--zap"|"--delete"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:hash_digests]=(cmd =~/N/ \ + || mod.inspect =~/"--hash-digests"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:sample_search_form]=(cmd =~/F/ \ + || mod.inspect =~/"--sample-search-form"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:webrick]=(cmd =~/W/ \ + || mod.inspect =~/"--webrick"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:share_source]=(cmd =~/s/ \ + || mod.inspect =~/"--source"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:sisupod]=(cmd =~/S/ \ + || mod.inspect =~/"--sisupod"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:scp]=(cmd =~/r/ \ + || mod.inspect =~/"--scp"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:rsync]=(cmd =~/R/ \ + || mod.inspect =~/"--rsync"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:delete_output]=(cmd =~/z/ \ + || mod.inspect =~/"--delete"|"--zap"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:urls_all]=(cmd =~/U/ \ + || mod.inspect =~/"--urls-all"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:urls_selected]=(cmd =~/u/ \ + || mod.inspect =~/"--urls"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:sitemap]=(cmd =~/Y/ \ + || mod.inspect =~/"--sitemap"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:qrcode]=(cmd =~/Q/ \ + || mod.inspect =~/"--qrcode"/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + act[:help]=(mod.inspect =~/"--help/) \ + ? { bool: true, set: :on } + : { bool: false, set: :na } + @act=act end - act[:dal]=(cmd =~/m/ \ - || mod.inspect =~/"--dal"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:html]=(cmd =~/h/ \ - || mod.inspect =~/"--html"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:concordance]=(cmd =~/w/ \ - || mod.inspect =~/"--concordance"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:images]=(cmd =~/j/ \ - || mod.inspect =~/"--images"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:pdf]=(cmd =~/p/ \ - || mod.inspect =~/"--pdf"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:epub]=(cmd =~/e/ \ - || mod.inspect =~/"--epub"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:odt]=(cmd =~/o/ \ - || mod.inspect =~/"--odt"|"--odf"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_sax]=(cmd =~/x/ \ - || mod.inspect =~/"--xml-sax"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xml_dom]=(cmd =~/X/ \ - || mod.inspect =~/"--xml-dom"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:xhtml]=(cmd =~/b/ \ - || mod.inspect =~/"--xhtml"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:txt]=(cmd =~/[at]/ \ - || mod.inspect =~/"--txt"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:manpage]=(cmd =~/i/ \ - || mod.inspect =~/"--manpage"|"--man"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:texinfo]=(cmd =~/I/ \ - || mod.inspect =~/"--texinfo"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:fictionbook]=(cmd =~/f/ \ - || mod.inspect =~/"--fictionbook"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:psql]=(cmd =~/D/ \ - || mod.inspect =~/"--pg"|"--pgsql"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sqlite]=(cmd =~/d/ \ - || mod.inspect =~/"--sqlite"/) \ - && (mod.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sqlite_discreet]=(cmd =~/d/ \ - || mod.inspect =~/"--sql"|"--sqlite"/) \ - && (mod.inspect =~/"--both"/ \ - || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:harvest]=(mod.inspect =~/"--harvest"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:po4a]=(cmd =~/P/ \ - || mod.inspect =~/"--po4a"|"--pot?"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:git]=(cmd =~/g/ \ - || mod.inspect =~/"--git"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:zap]=(cmd =~/Z/ \ - || mod.inspect =~/"--zap"|"--delete"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:hash_digests]=(cmd =~/N/ \ - || mod.inspect =~/"--hash-digests"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sample_search_form]=(cmd =~/F/ \ - || mod.inspect =~/"--sample-search-form"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:webrick]=(cmd =~/W/ \ - || mod.inspect =~/"--webrick"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:share_source]=(cmd =~/s/ \ - || mod.inspect =~/"--source"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sisupod]=(cmd =~/S/ \ - || mod.inspect =~/"--sisupod"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:scp]=(cmd =~/r/ \ - || mod.inspect =~/"--scp"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:rsync]=(cmd =~/R/ \ - || mod.inspect =~/"--rsync"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:delete_output]=(cmd =~/z/ \ - || mod.inspect =~/"--delete"|"--zap"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:urls_all]=(cmd =~/U/ \ - || mod.inspect =~/"--urls-all"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:urls_selected]=(cmd =~/u/ \ - || mod.inspect =~/"--urls"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:sitemap]=(cmd =~/Y/ \ - || mod.inspect =~/"--sitemap"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:qrcode]=(cmd =~/Q/ \ - || mod.inspect =~/"--qrcode"/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - act[:help]=(mod.inspect =~/"--help/) \ - ? { bool: true, set: :on } - : { bool: false, set: :na } - @act=act end def cmd @cmd @@ -798,7 +804,7 @@ module SiSU_Commandline @mod end def act - @act + @@act end def files_mod files_mod=files |