aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/hub_options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/hub_options.rb')
-rw-r--r--lib/sisu/v5/hub_options.rb966
1 files changed, 599 insertions, 367 deletions
diff --git a/lib/sisu/v5/hub_options.rb b/lib/sisu/v5/hub_options.rb
index f851b985..c079915b 100644
--- a/lib/sisu/v5/hub_options.rb
+++ b/lib/sisu/v5/hub_options.rb
@@ -51,7 +51,7 @@
* Git
<http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v6/hub_options.rb;hb=HEAD>
+ <http://sources.sisudoc.org/?p=code/sisu.git;a=blob;f=lib/sisu/v5/hub_options.rb;hb=HEAD>
* Ralph Amissah
<ralph@amissah.com>
@@ -156,11 +156,12 @@ module SiSU_Commandline
end
end
class Options
- attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+ attr_accessor :selections,:opt_ch,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:call_path,:base_path,:base_stub,:sub_location,:image_src_path,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
@@act=nil
def initialize(a,call_path)
- @cmd=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
- @f_pths,@files,@files_mod,@paths,@mod,@act=Array.new(5){[]}
+ @opt_ch=@f_pth=@pth=@fno=@fns=@fnb=@fnc=@fng=@fncb=@what=@lng=@lng_base=@call_path=@base_path=@base_stub=@image_src_path=@sub_location=''
+ @f_pths,@files,@files_mod,@paths,@select_arr,@act=Array.new(5){[]}
+ @select_str=nil
@env=SiSU_Env::InfoEnv.new
@lng_base=@env.language_default_set
@dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
@@ -269,24 +270,25 @@ module SiSU_Commandline
if a.length > 0
s=expand_numeric_shortcuts(a)
q=set_files_and_paths_and_general_extract(s)
- @cmd,@mod=opt_cmd_and_mod_adjust(q[:cmd],q[:mod])
+ files=(q[:files].length > 0) ? :true : :false
+ @select_arr=opt_cmd_and_mod_adjust(q[:opt_ch],q[:selections],files)
@what=q[:what] unless q[:what].empty?
@paths = q[:paths]
@files = q[:files]
@f_pths = q[:f_pths]
@lngs = q[:lngs]
if @files.length > 0 \
- and @cmd.empty? \
- and @mod.length==0 #% if no other action called on filename given, default is sisu --v5 -0 [filename(s)] configured as flag default
+ and @opt_ch.empty? \
+ and @select_arr.length==0 #% if no other action called on filename given, default is sisu --v5 -0 [filename(s)] configured as flag default
shortcut=SiSU_Env::InfoProcessingFlag.new
- @mod=['--v5']
- @cmd=shortcut.cf_0 + ' --dal'
+ @select_arr=['--v5']
+ @select_arr << shortcut.act_0.arr #+ ' --dal'
end
- if @cmd =~/[vVM]/ \
- && @cmd !~/-[ku]*v[ku]*$/
+ if @select_arr.inspect =~/--verbose/ \
+ && @opt_ch !~/-[ku]*v[ku]*$/
SiSU_Screen::Ansi.new(
- @cmd,
- "\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n"
+ @opt_ch,
+ "\tsisu " + @opt_ch + ' ' + @select_arr.join(' ') + ' ' + @files.join(' ') + "\n"
).print_brown
end
end
@@ -443,8 +445,8 @@ module SiSU_Commandline
end
end
{
- cmd: c,
- mod: m,
+ opt_ch: c,
+ selections: m,
what: w,
paths: pth,
files: f,
@@ -454,387 +456,583 @@ module SiSU_Commandline
}
end
def expand_numeric_shortcuts(a)
+ s=''
+ a.each do |x|
+ y=case x
+ when /0/
+ (x=~/^-0\S+/) \
+ ? x.gsub(/^-0(\S+)/,'--act0' + ' -\1')
+ : x.gsub(/^-0/,'--act0' + ' ')
+ when /1/
+ (x=~/^-1\S+/) \
+ ? x.gsub(/^-1(\S+)/,'--act1' + ' -\1')
+ : x.gsub(/^-1/,'--act1' + ' ')
+ when /2/
+ (x=~/^-2\S+/) \
+ ? x.gsub(/^-2(\S+)/,'--act2' + ' -\1')
+ : x.gsub(/^-2/,'--act2' + ' ')
+ when /3/
+ (x=~/^-3\S+/) \
+ ? x.gsub(/^-3(\S+)/,'--act3' + ' -\1')
+ : x.gsub(/^-3/,'--act3' + ' ')
+ when /4/
+ (x=~/^-4\S+/) \
+ ? x.gsub(/^-4(\S+)/,'--act4' + ' -\1')
+ : x.gsub(/^-4/,'--act4' + ' ')
+ when /5/
+ (x=~/^-5\S+/) \
+ ? x.gsub(/^-5(\S+)/,'--act5' + ' -\1')
+ : x.gsub(/^-5/,'--act5' + ' ')
+ when /6/
+ (x=~/^-6\S+/) \
+ ? x.gsub(/^-6(\S+)/,'--act6' + ' -\1')
+ : x.gsub(/^-6/,'--act6' + ' ')
+ when /7/
+ (x=~/^-7\S+/) \
+ ? x.gsub(/^-7(\S+)/,'--act7' + ' -\1')
+ : x.gsub(/^-7/,'--act7' + ' ')
+ when /8/
+ (x=~/^-8\S+/) \
+ ? x.gsub(/^-8(\S+)/,'--act8' + ' -\1')
+ : x.gsub(/^-8/,'--act8' + ' ')
+ when /9/
+ (x=~/^-9\S+/) \
+ ? x.gsub(/^-9(\S+)/,'--act9' + ' -\1')
+ : x.gsub(/^-9/,'--act9' + ' ')
+ else x
+ end
+ s << " #{y}" unless y.empty?
+ end
+ s.strip!
+ end
+ def expand_numeric_shortcuts_(a)
shortcut=SiSU_Env::InfoProcessingFlag.new
s=''
a.each do |x|
y=case x
when /0/
(x=~/^-0\S+/) \
- ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1')
- : x.gsub(/^-0/,shortcut.cf_0 + ' ')
+ ? x.gsub(/^-0(\S+)/,shortcut.act_0.str + ' -\1')
+ : x.gsub(/^-0/,shortcut.act_0.str + ' ')
when /1/
(x=~/^-1\S+/) \
- ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1')
- : x.gsub(/^-1/,shortcut.cf_1 + ' ')
+ ? x.gsub(/^-1(\S+)/,shortcut.act_1.str + ' -\1')
+ : x.gsub(/^-1/,shortcut.act_1.str + ' ')
when /2/
(x=~/^-2\S+/) \
- ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1')
- : x.gsub(/^-2/,shortcut.cf_2 + ' ')
+ ? x.gsub(/^-2(\S+)/,shortcut.act_2.str + ' -\1')
+ : x.gsub(/^-2/,shortcut.act_2.str + ' ')
when /3/
(x=~/^-3\S+/) \
- ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1')
- : x.gsub(/^-3/,shortcut.cf_3 + ' ')
+ ? x.gsub(/^-3(\S+)/,shortcut.act_3.str + ' -\1')
+ : x.gsub(/^-3/,shortcut.act_3.str + ' ')
when /4/
(x=~/^-4\S+/) \
- ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1')
- : x.gsub(/^-4/,shortcut.cf_4 + ' ')
+ ? x.gsub(/^-4(\S+)/,shortcut.act_4.str + ' -\1')
+ : x.gsub(/^-4/,shortcut.act_4.str + ' ')
when /5/
(x=~/^-5\S+/) \
- ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1')
- : x.gsub(/^-5/,shortcut.cf_5 + ' ')
+ ? x.gsub(/^-5(\S+)/,shortcut.act_5.str + ' -\1')
+ : x.gsub(/^-5/,shortcut.act_5.str + ' ')
when /6/
(x=~/^-6\S+/) \
- ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1')
- : x.gsub(/^-6/,shortcut.cf_5 + ' ')
+ ? x.gsub(/^-6(\S+)/,shortcut.act_6.str + ' -\1')
+ : x.gsub(/^-6/,shortcut.act_6.str + ' ')
+ when /7/
+ (x=~/^-7\S+/) \
+ ? x.gsub(/^-7(\S+)/,shortcut.act_7.str + ' -\1')
+ : x.gsub(/^-7/,shortcut.act_7.str + ' ')
+ when /8/
+ (x=~/^-8\S+/) \
+ ? x.gsub(/^-8(\S+)/,shortcut.act_8.str + ' -\1')
+ : x.gsub(/^-8/,shortcut.act_8.str + ' ')
+ when /9/
+ (x=~/^-9\S+/) \
+ ? x.gsub(/^-9(\S+)/,shortcut.act_9.str + ' -\1')
+ : x.gsub(/^-9/,shortcut.act_9.str + ' ')
else x
end
s << " #{y}" unless y.empty?
end
s.strip!
end
- def opt_cmd_and_mod_adjust(c,m)
- cmd,mod,files=@cmd,@mod,@files
- if not m.empty? \
- and m.inspect =~/"--pdf-/
- mod << '--pdf'
- m.each do |s|
- if s =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/
- mod << '--landscape'
- end
- if s =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/
- mod << '--portrait'
- end
- if s =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/
- if s =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/
- mod << '--papersize-a4'
- end
- if s =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/
- mod << '--papersize-a5'
+ def opt_cmd_and_mod_adjust(ch,select_arr,files)
+if @select_arr.length > 0
+ p __LINE__
+ p @selection
+end
+ select_arr=select_arr.flatten
+ sel_init=select_arr.flatten
+ shortcut=SiSU_Env::InfoProcessingFlag.new
+ if files ==:true
+ if not sel_init.empty? \
+ and sel_init.inspect =~/"--act[0-9]/
+ sel_init.each do |s|
+ select_arr <<=case s
+ when /--act0/ then shortcut.act_0.arr
+ when /--act1/ then shortcut.act_1.arr
+ when /--act2/ then shortcut.act_2.arr
+ when /--act3/ then shortcut.act_3.arr
+ when /--act4/ then shortcut.act_4.arr
+ when /--act5/ then shortcut.act_5.arr
+ when /--act6/ then shortcut.act_6.arr
+ when /--act7/ then shortcut.act_7.arr
+ when /--act8/ then shortcut.act_8.arr
+ when /--act9/ then shortcut.act_9.arr
end
- if s =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/
- mod << '--papersize-b5'
+ end
+ end
+ if not sel_init.empty? \
+ and sel_init.inspect =~/"--pdf-/
+ select_arr << '--pdf'
+ sel_init.each do |s|
+ if s =~ /^--pdf-(?:(?:l|landscape)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:l|landscape))$/
+ select_arr << '--landscape'
end
- if s =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/
- mod << '--papersize-letter'
+ if s =~ /^--pdf-(?:(?:p|portrait)(?:-(?:a4|letter|a5|b5|legal))?|(?:a4|letter|a5|b5|legal)-(?:p|portrait))$/
+ select_arr << '--portrait'
end
- if s =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/
- mod << '--papersize-legal'
+ if s =~ /^--pdf(?:-(?:a4|letter|a5|b5|legal)(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))(?:-(?:a4|letter|a5|b5|legal)))$/
+ if s =~ /^--pdf(?:-a4(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a4)$/
+ select_arr << '--papersize-a4'
+ end
+ if s =~ /^--pdf(?:-a5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-a5)$/
+ select_arr << '--papersize-a5'
+ end
+ if s =~ /^--pdf(?:-b5(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-b5)$/
+ select_arr << '--papersize-b5'
+ end
+ if s =~ /^--pdf(?:-letter(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-letter)$/
+ select_arr << '--papersize-letter'
+ end
+ if s =~ /^--pdf(?:-legal(?:-(?:[lp]|landscape|portrait))?|(?:-(?:[lp]|landscape|portrait))-legal)$/
+ select_arr << '--papersize-legal'
+ end
end
end
+ select_arr=select_arr.uniq
end
- mod=mod.uniq
- end
- unless m.empty?
- m.each do |s|
- case s
- when /^--(?:color-toggle)$/ then c=c+'c'
- when /^--(?:color-off)$/ then c=c+'k'
- when /^--(?:conf|config|configure|init|initialize|init-site)$/ then c=c+'CC'
- when /^--(?:ao|dal?|machine|abstraction|abs)$/ then c=c+'m'
- when /^--(?:txt|text|plaintext)$/ then c=c+'t'
- when /^--(?:html)$/ then c=c+'h'
- when /^--(?:html-scroll|html-seg)$/ then c=c+'H'
- mod << s
- when /^--(?:epub)$/ then c=c+'e'
- when /^--(?:od[ft])$/ then c=c+'o'
- when /^--docbook$/ then c=c+'d'
- when /^--(?:pdf)$/ then c=c+'p'
- when /^--pdf-(?:a4|a5|b5|legal|letter)$/ then c=c+'p'
- when /^--pdf-(?:p|l|portrait|landscape)$/ then c=c+'L'
- when /^--pdf-(?:p(?:ortrait)?|l(?:andscape)?)-(?:a4|letter|a5|b5|legal)$/ then c=c+'L'
- when /^--pdf-(?:a4|letter|a5|b5|legal)-(?:p(?:ortrait)?|l(?:andscape)?)$/ then c=c+'L'
- when /^--(?:concordance|wordmap)$/ then c=c+'w'
- when /^--(?:manpage|man)$/ then c=c+'i'
- when /^--(?:texinfo)$/ then c=c+'I'
- when /^--(?:xhtml)$/ then c=c+'b'
- when /^--(?:xml-sax)$/ then c=c+'x'
- when /^--(?:xml-dom)$/ then c=c+'X'
- when /^--(?:images)$/ then c=c+'j'
- when /^--(?:digests?|hash-digests)$/ then c=c+'N'
- when /^--(?:po4a|pot?)$/ then c=c+'P'
- when /^--(?:termsheet)$/ then c=c+'T'
- when /^--(?:manifest)$/ then c=c+'y'
- when /^--(?:qrcode)$/ then c=c+'Q'
- when /^--(?:remote|rsync)$/ then c=c+'R'
- when /^--(?:scp)$/ then c=c+'r'
- when /^--(?:source)$/ then c=c+'s'
- when /^--(?:sisupod|pod)$/ then c=c+'S'
- when /^--(?:git)$/ then c=c+'g'
- when /^--(?:urls)$/ then c=c+'U'
- when /^--(?:zap|delete)$/ then c=c+'Z'
- when /^--(?:sample-search-form)$/ then c=c+'F'
- when /^--(?:webserv|webrick)$/ then c=c+'W'
- when /^--(?:profile)$/ then c=c+'E'
- when /^--(?:maintenance|keep-processing-files)$/ then c=c+'M'
- when /^--(?:verbose[=-]3)$/ then c=c+'VM'
- when /^--(?:verbose[=-]2|Verbose|VERBOSE)$/ then c=c+'V'
- when /^--(?:verbose(?:[=-]1)?)$/ then c=c+'v'
- when /^--(?:version)$/ then c=c+'v'
- when /^--(?:verbose[=-]0|quiet|silent)$/ then c=c+'q'
- else mod << s #mod only contains command modifiers; commands converted to character
+ if ch.empty? \
+ and sel_init.length == 0
+ select_arr << shortcut.act_0.arr ################ & --flag empty
+ elsif not ch.empty?
+ if ch =~/c/ then select_arr << '--color-toggle'
+ ch=ch.gsub(/[c]/,'')
+ end
+ if ch =~/k/ then select_arr << '--color-off'
+ ch=ch.gsub(/[k]/,'')
+ end
+ if ch =~/C/ then select_arr << '--config'
+ ch=ch.gsub(/[C]+/,'')
+ end
+ if ch =~/m/ then select_arr << '--dal'
+ ch=ch.gsub(/[m]/,'')
+ end
+ if ch =~/t/ then select_arr << '--txt'
+ ch=ch.gsub(/[t]/,'')
+ end
+ if ch =~/h/ then select_arr << '--html'
+ ch=ch.gsub(/[h]/,'')
+ end
+ if ch =~/e/ then select_arr << '--epub'
+ ch=ch.gsub(/[e]/,'')
+ end
+ if ch =~/o/ then select_arr << '--odt'
+ ch=ch.gsub(/[o]/,'')
+ end
+ if ch =~/d/ then select_arr << '--docbook'
+ ch=ch.gsub(/[d]/,'')
+ end
+ if ch =~/p/ then select_arr << '--pdf'
+ ch=ch.gsub(/[p]/,'')
+ end
+ if ch =~/w/ then select_arr << '--concordance'
+ ch=ch.gsub(/[w]/,'')
+ end
+ if ch =~/i/ then select_arr << '--manpage'
+ ch=ch.gsub(/[i]/,'')
+ end
+ if ch =~/I/ then select_arr << '--texinfo'
+ ch=ch.gsub(/[I]/,'')
+ end
+ if ch =~/b/ then select_arr << '--xhtml'
+ ch=ch.gsub(/[b]/,'')
+ end
+ if ch =~/x/ then select_arr << '--xml-sax'
+ ch=ch.gsub(/[x]/,'')
+ end
+ if ch =~/X/ then select_arr << '--xml-dom'
+ ch=ch.gsub(/[X]/,'')
+ end
+ if ch =~/j/ then select_arr << '--images'
+ ch=ch.gsub(/[j]/,'')
+ end
+ if ch =~/N/ then select_arr << '--digests'
+ ch=ch.gsub(/[N]/,'')
+ end
+ if ch =~/P/ then select_arr << '--po4a'
+ ch=ch.gsub(/[P]/,'')
+ end
+ if ch =~/d/ then select_arr << '--sqlite'
+ ch=ch.gsub(/[d]/,'')
+ end
+ if ch =~/D/ then select_arr << '--pg'
+ ch=ch.gsub(/[D]/,'')
+ end
+ if ch =~/Q/ then select_arr << '--qrcode'
+ ch=ch.gsub(/[Q]/,'')
+ end
+ if ch =~/s/ then select_arr << '--source'
+ ch=ch.gsub(/[s]/,'')
+ end
+ if ch =~/S/ then select_arr << '--sisupod'
+ ch=ch.gsub(/[S]/,'')
+ end
+ if ch =~/m/ then select_arr << '--manifest'
+ ch=ch.gsub(/[m]/,'')
+ end
+ if ch =~/R/ then select_arr << '--rsync'
+ ch=ch.gsub(/[R]/,'')
+ end
+ if ch =~/r/ then select_arr << '--scp'
+ ch=ch.gsub(/[r]/,'')
+ end
+ if ch =~/g/ then select_arr << '--git'
+ ch=ch.gsub(/[g]/,'')
+ end
+ if ch =~/U/ then select_arr << '--urls'
+ ch=ch.gsub(/[u]/,'')
+ end
+ if ch =~/Z/ then select_arr << '--zap'
+ ch=ch.gsub(/[Z]/,'')
+ end
+ if ch =~/F/ then select_arr << '--sample-search-form'
+ ch=ch.gsub(/[F]/,'')
+ end
+ if ch =~/w/ then select_arr << '--webrick'
+ ch=ch.gsub(/[w]/,'')
+ end
+ if ch =~/M/ then select_arr << '--maintenance'
+ ch=ch.gsub(/[M]/,'')
+ end
+ if ch =~/V/ then select_arr << '--very-verbose'
+ ch=ch.gsub(/[V]/,'')
+ end
+ if ch =~/v/ then select_arr << '--verbose'
+ ch=ch.gsub(/[v]/,'')
+ end
+ if ch =~/q/ then select_arr << '--quiet'
+ ch=ch.gsub(/[q]/,'')
+ end
+ if select_arr.inspect !~/--urls/ \
+ and select_arr.inspect \
+ !~/"--harvest/
+ select_arr << '--urls'
+ end
+ if select_arr.inspect !~/--dal/ \
+ and select_arr.inspect =~/txt|text|html|odt|epub|docbook|xml|pdf|manpage|texinfo|concordance|qrcode|source|sisupod|pg|sqlite|zap/
+ select_arr << '--dal'
+ end
+ if select_arr.inspect !~/--manifest/ \
+ and select_arr.inspect =~/txt|text|html|odt|epub|docbook|xml|pdf|manpage|texinfo|concordance|qrcode|source|sisupod|pg|sqlite|zap/
+ select_arr << '--manifest'
+ end
+ if select_arr.inspect !~/--images/ \
+ and select_arr.inspect =~/html|odt|docbook|xml|qrcode/
+ select_arr << '--images'
end
end
- end
- ca=[]
- unless c.empty?
- c=c.gsub(/-/,'')
- c.scan(/CC|\S/) {|x| ca << x}
- cmd= '-' + ca.uniq.join
- end
- extra=''
- if cmd !~/[mn]/
- extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
- and cmd !~/[mn]/
- 'm' #% add ao
- elsif ((mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
- and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
- and cmd !~/[mn]/
- 'm' #% add ao
- else ''
+ else
+ if ch =~/C/ then select_arr << '--config'
+ ch=ch.gsub(/[C]+/,'')
end
- end
- if cmd !~/j/
- extra+=if cmd =~/[bdHhwXxyz]/ \
- and cmd !~/[j]/
- 'j' #% copy images
- else ''
+ if sel_init.inspect =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"/
+ if ch =~/d/ then select_arr << '--sqlite'
+ ch=ch.gsub(/[d]/,'')
+ end
+ if ch =~/D/ then select_arr << '--pg'
+ ch=ch.gsub(/[D]/,'')
+ end
end
- end
- if cmd !~/y/
- extra+=if cmd =~/[abdeHhIiNopQSstwXxz]/ \
- and cmd !~/y/
- 'ym' #% add manifest
- elsif mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \
- and files[0] !~/^remove$/ \
- and cmd !~/y/
- 'ym' #% add manifest
- else ''
+ if ch =~/v/ then select_arr << '--version'
+ ch=ch.gsub(/[v]/,'')
end
end
- if cmd !~/u/ #% add urls
- extra+='u'
- end
- cmd=cmd + extra
- cmds=cmd.scan(/CC|\S/)
- [cmds.uniq.join,mod]
+ select_arr=select_arr.flatten.compact.uniq.sort
end
- def opt_act #note mod line commands have already been converted to command characters, cmd
- cmd,mod=@cmd,@mod
+ def opt_act
+ select_arr=@select_arr
@@act=if @@act
@act=@@act
else
act={}
- act[:license]=(mod.inspect =~/"--license/) \
+ act[:license]=(select_arr.inspect \
+ =~/"--license/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:site_init]=(cmd =~/C/ \
- || mod.inspect =~/"--init"|"--initialize"|"--init-site"|"--conf"|"--config"|"--configure"/) \
+ act[:site_init]=(select_arr.inspect \
+ =~/"--init"|"--initialize"|"--init-site"|"--conf"|"--config"|"--configure"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:rc]=if mod.inspect =~/"--rc=/
- x=Dir.pwd + '/' + mod.join.gsub(/--rc=/,'')
+ act[:rc]=if select_arr.inspect \
+ =~/"--rc=/
+ x=Dir.pwd + '/' + select_arr.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')
+ act[:processing_path]=if select_arr.inspect \
+ =~/"--processing-path=/
+ base_pth=select_arr.join(';').gsub(/^.*--processing-path=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
{ bool: true, set: :on, inst: base_pth }
- elsif mod.inspect =~/"--processing-path/
+ elsif select_arr.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')
+ act[:dump]=if select_arr.inspect \
+ =~/"--dump=/
+ base_pth=select_arr.join(';').
+ gsub(/^.*--dump=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
{ bool: true, set: :on, inst: base_pth }
- elsif mod.inspect =~/"--dump/
+ elsif select_arr.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')
+ act[:redirect]=if select_arr.inspect \
+ =~/"--redirect=/
+ base_pth=select_arr.join(';').
+ gsub(/^.*--redirect=['"]?(.+?)(?:['"]?;.+)?$/,'\1')
{ bool: true, set: :on, inst: base_pth }
- elsif mod.inspect =~/"--redirect/
+ elsif select_arr.inspect \
+ =~/"--redirect/
{ bool: true, set: :on, inst: @base_path }
else
{ bool: false, set: :na, inst: nil }
end
- act[:switch]=if mod.inspect =~/"--switch-off=/
- off_list=mod.join(';').gsub(/^.*--switch-off=['"]?(.+?)(?:['"];.+)?$/,'\1')
+ act[:switch]=if select_arr.inspect \
+ =~/"--switch-off=/
+ off_list=select_arr.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[:default_language]=if mod.inspect =~/"--(?:default-)?language[-=](\S{2})"/
+ act[:default_language]=if select_arr.inspect \
+ =~/"--(?:default-)?language[-=](\S{2})"/
{ set: :on, code: $1 }
elsif lng_base
{ set: :on, code: lng_base }
else { set: :na, code: 'en' }
end
- act[:i18n]=if mod.inspect =~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected
+ act[:i18n]=if select_arr.inspect \
+ =~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected
@lingual=:mono
{ set: :mono }
- elsif mod.inspect =~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/
+ elsif select_arr.inspect \
+ =~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/
@lingual=:multi
{ set: :multi }
else { set: :na }
end
- act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/
+ act[:output_by]=if select_arr.inspect \
+ =~/"--(?:output-)?by-language"/
@dir_structure_by=:language
{ set: :language }
- elsif mod.inspect =~/"--(?:output-)?by-filename"/
+ elsif select_arr.inspect \
+ =~/"--(?:output-)?by-filename"/
@dir_structure_by=:filename
{ set: :filename }
- elsif mod.inspect =~/"--(?:output-)?by-filetype"/
+ elsif select_arr.inspect \
+ =~/"--(?:output-)?by-filetype"/
@dir_structure_by=:filetype
{ set: :filetype }
else { set: :na }
end
- act[:ocn]=if mod.inspect =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/
+ act[:ocn]=if select_arr.inspect \
+ =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ \
+ elsif select_arr.inspect \
+ =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/ \
|| act[:switch][:off].inspect =~/"ocn"|"--numbering"/
{ bool: false, set: :off }
else { bool: true, set: :na }
end
- act[:toc]=if mod.inspect =~/"--inc-toc"/
+ act[:toc]=if select_arr.inspect \
+ =~/"--inc-toc"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-toc"/ \
+ elsif select_arr.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"/
+ act[:minitoc]=if select_arr.inspect \
+ =~/"--inc-minitoc"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-minitoc"/ \
+ elsif select_arr.inspect \
+ =~/"--(?:exc|no)-minitoc"/ \
|| act[:switch][:off].inspect =~/"minitoc"/
{ bool: false, set: :off }
else { bool: true, set: :na }
end
- act[:links_to_manifest]=if mod.inspect =~/"--inc-links-to-manifest"|"--inc-manifest-links"/
+ act[:links_to_manifest]=if select_arr.inspect \
+ =~/"--inc-links-to-manifest"|"--inc-manifest-links"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \
+ elsif select_arr.inspect \
+ =~/"--(?:exc|no)-manifest"/ \
|| act[:switch][:off].inspect =~/"manifest"/ #place lower
{ bool: false, set: :off }
- 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)/
+ elsif select_arr.inspect \
+ =~/"--(?:exc|no)-links-to-manifest"|"--(?:exc|no)-manifest-links"/ \
+ || act[:switch][:off].inspect \
+ =~/"links_to_manifest"|"manifest_links"|"--(?:exc|no)-manifest"/ \
+ || select_arr.inspect \
+ =~/"--(?:redirect|dump)/
{ bool: false, set: :off }
else { bool: true, set: :na }
end
- act[:manifest_minitoc]=if mod.inspect =~/"--inc-manifest-minitoc"|"--inc-minitoc"/
+ act[:manifest_minitoc]=if select_arr.inspect \
+ =~/"--inc-manifest-minitoc"|"--inc-minitoc"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-manifest-minitoc"|"--(?:exc|no)-minitoc"/ \
+ elsif select_arr.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"/
+ act[:metadata]=if select_arr.inspect \
+ =~/"--inc-metadata"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-metadata"/ \
+ elsif select_arr.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"/
+ act[:html_minitoc]=if select_arr.inspect \
+ =~/"--inc-html-minitoc"|"--inc-minitoc"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-minitoc"|"--(?:exc|no)-minitoc"/ \
+ elsif select_arr.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"/
+ act[:html_navigation]=if select_arr.inspect \
+ =~/"--inc-html-navigation"|"--inc-navigation"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-navigation"|"--(?:exc|no)-navigation"/ \
+ elsif select_arr.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"/
+ act[:html_navigation_bar]=if select_arr.inspect \
+ =~/"--inc-html-navigation-bar"|"--inc-navigation-bar"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-navigation-bar"|"--(?:exc|no)-navigation-bar"/ \
+ elsif select_arr.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"/
+ act[:segsubtoc]=if select_arr.inspect \
+ =~/"--inc-segsubtoc"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-segsubtoc"/ \
+ elsif select_arr.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"/
+ act[:search_form]=if select_arr.inspect \
+ =~/"--inc-search-form"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-search-form"/ \
+ elsif select_arr.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"/
+ act[:html_search_form]=if select_arr.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"/
+ elsif select_arr.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"/
+ act[:html_right_pane]=if select_arr.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"/ \
+ elsif select_arr.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"/
+ act[:html_top_band]=if select_arr.inspect \
+ =~/"--inc-html-top-band"|"--inc-top-band"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-html-top-band"|"--(?:exc|no)-top-band"/ \
+ elsif select_arr.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[:html]=if mod.inspect =~/"--html-strict"/ \
- or ((cmd =~/h/ || mod.inspect =~/"--html"/) \
- && mod.inspect =~/"--strict"/)
+ act[:html]=if select_arr.inspect \
+ =~/"--html-strict"/ \
+ or ((select_arr.inspect \
+ =~/"--html"/) \
+ && select_arr.inspect \
+ =~/"--strict"/)
act[:html_strict]={ bool: true, set: :on }
act[:html_scroll]={ bool: true, set: :on }
act[:html_seg]={ bool: true, set: :on }
{ bool: true, set: :on }
- elsif (cmd =~/h/ \
- || mod.inspect =~/"--html"/)
+ elsif (select_arr.inspect \
+ =~/"--html"/)
act[:html_strict]={ bool: false, set: :off }
act[:html_scroll]={ bool: true, set: :on }
act[:html_seg]={ bool: true, set: :on }
{ bool: true, set: :on }
else
- act[:html_strict]=(mod.inspect =~/"--strict"/) \
+ act[:html_strict]=(select_arr.inspect \
+ =~/"--strict"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:html_scroll]=(mod.inspect =~/"--html-scroll"/) \
+ act[:html_scroll]=(select_arr.inspect \
+ =~/"--html-scroll"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:html_seg]=(mod.inspect =~/"--html-seg"/) \
+ act[:html_seg]=(select_arr.inspect \
+ =~/"--html-seg"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
{ bool: false, set: :na }
end
- act[:concordance]=(cmd =~/w/ \
- || mod.inspect =~/"--concordance"/) \
+ act[:concordance]=(select_arr.inspect \
+ =~/"--concordance"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:images]=(cmd =~/j/ \
- || mod.inspect =~/"--images"/) \
+ act[:images]=(select_arr.inspect \
+ =~/"--images"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- if (cmd =~/p/ \
- || mod.inspect =~/"--pdf"/)
- if mod.inspect =~/"--portrait"/
+ if select_arr.inspect \
+ =~/"--pdf"/
+ if select_arr.inspect \
+ =~/"--portrait"/
act[:pdf]= { bool: false, set: :na }
act[:pdf_l]={ bool: false, set: :na }
act[:pdf_p]={ bool: true, set: :on }
- elsif mod.inspect =~/"--landscape"/
+ elsif select_arr.inspect \
+ =~/"--landscape"/
act[:pdf]= { bool: false, set: :na }
act[:pdf_l]={ bool: true, set: :on }
act[:pdf_p]={ bool: false, set: :na }
@@ -856,47 +1054,60 @@ module SiSU_Commandline
if act[:pdf][:set]==:on \
or act[:pdf_p][:set]==:on \
or act[:pdf_l][:set]==:on
- act[:pdf_a4]=if mod.inspect =~/"--a4"|--papersize-a4"/ \
- or mod.inspect =~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5
+ act[:pdf_a4]=if select_arr.inspect \
+ =~/"--a4"|--papersize-a4"/ \
+ or select_arr.inspect \
+ =~/"--papersize=\S*a4\b\S*"/ #--papersize=a4,a5
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:pdf_a5]=if mod.inspect =~/"--a5"|"--papersize-a5"/ \
- or mod.inspect =~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5
+ act[:pdf_a5]=if select_arr.inspect \
+ =~/"--a5"|"--papersize-a5"/ \
+ or select_arr.inspect \
+ =~/"--papersize=\S*a5\b\S*"/ #--papersize=a4,a5
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:pdf_b5]=if mod.inspect =~/"--b5"|"--papersize-b5"/ \
- or mod.inspect =~/"--papersize=\S*b5\b\S*"/
+ act[:pdf_b5]=if select_arr.inspect \
+ =~/"--b5"|"--papersize-b5"/ \
+ or select_arr.inspect \
+ =~/"--papersize=\S*b5\b\S*"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:pdf_letter]=if mod.inspect =~/"--letter"|"--papersize-letter"/ \
- or mod.inspect =~/"--papersize=\S*letter\b\S*"/
+ act[:pdf_letter]=if select_arr.inspect \
+ =~/"--letter"|"--papersize-letter"/ \
+ or select_arr.inspect \
+ =~/"--papersize=\S*letter\b\S*"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:pdf_legal]=if mod.inspect =~/"--legal"|"--papersize-legal"/ \
- or mod.inspect =~/"--papersize=\S*legal\b\S*"/
+ act[:pdf_legal]=if select_arr.inspect \
+ =~/"--legal"|"--papersize-legal"/ \
+ or select_arr.inspect \
+ =~/"--papersize=\S*legal\b\S*"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
end
- act[:epub]=(cmd =~/e/ \
- || mod.inspect =~/"--epub"/) \
+ act[:epub]=(select_arr.inspect \
+ =~/"--epub"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:odt]=if cmd =~/o/ \
- or mod.inspect =~/"--odt"|"--odf"|"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/
- act[:odt_ocn]=if (mod.inspect =~/"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/ \
- or mod.inspect =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
+ act[:odt]=if select_arr.inspect \
+ =~/"--odt"|"--odf"|"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/
+ act[:odt_ocn]=if (select_arr.inspect \
+ =~/"--odt-(?:ocn|numbering)"|"--odf-(?:ocn|numbering)"/ \
+ or select_arr.inspect \
+ =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
{ bool: true, set: :on }
- elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
+ elsif select_arr.inspect \
+ =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
{ bool: false, set: :off }
else
{ bool: false, set: :na }
@@ -905,38 +1116,43 @@ module SiSU_Commandline
else
{ bool: false, set: :na }
end
- act[:xml_sax]=(cmd =~/x/ \
- || mod.inspect =~/"--xml-sax"/) \
+ act[:xml_sax]=(select_arr.inspect \
+ =~/"--xml-sax"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_dom]=(cmd =~/X/ \
- || mod.inspect =~/"--xml-dom"/) \
+ act[:xml_dom]=(select_arr.inspect \
+ =~/"--xml-dom"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_docbook_book]=(cmd =~/d/ \
- || mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \
+ act[:xml_docbook_book]=(select_arr.inspect \
+ =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_fictionbook]=(cmd =~/f/ \
- || mod.inspect =~/"--fictionbook"|"--xml-fictionbook"/) \
+ act[:xml_fictionbook]=(select_arr.inspect \
+ =~/"--fictionbook"|"--xml-fictionbook"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_scaffold_structure_sisu]=mod.inspect =~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \
+ act[:xml_scaffold_structure_sisu]=select_arr.inspect \
+ =~/"--xml-scaffold"|"--xml-scaffold-sisu"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_scaffold_structure_collapse]=mod.inspect =~/"--xml-scaffold-collapse"/ \
+ act[:xml_scaffold_structure_collapse]=select_arr.inspect \
+ =~/"--xml-scaffold-collapse"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xhtml]=(cmd =~/b/ \
- || mod.inspect =~/"--xhtml"/) \
+ act[:xhtml]=(select_arr.inspect \
+ =~/"--xhtml"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:txt]=if cmd =~/[at]/ \
- or mod.inspect =~/"--txt"|"--text"|"--plaintext"|"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/
- act[:txt_ocn]=if (mod.inspect =~/"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/ \
- or mod.inspect =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
+ act[:txt]=if select_arr.inspect \
+ =~/"--txt"|"--text"|"--plaintext"|"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/
+ act[:txt_ocn]=if (select_arr.inspect \
+ =~/"--txt-(?:ocn|numbering)"|"--text-(?:ocn|numbering)"|"--plaintext-(?:ocn|numbering)"/ \
+ or select_arr.inspect \
+ =~/"--ocn"|"--inc-ocn"|"--numbering"|"--inc-numbering"/)
{ bool: true, set: :on }
- elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
+ elsif select_arr.inspect \
+ =~/"--no-ocn"|"--exc-ocn"|"--no-numbering"|"--exc-numbering"/
{ bool: false, set: :off }
else
{ bool: false, set: :na }
@@ -945,66 +1161,71 @@ module SiSU_Commandline
else
{ bool: false, set: :na }
end
- act[:txt_textile]=(mod.inspect =~/"--textile"/) \
+ act[:txt_textile]=(select_arr.inspect \
+ =~/"--textile"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:txt_asciidoc]=(mod.inspect =~/"--asciidoc"/) \
+ act[:txt_asciidoc]=(select_arr.inspect \
+ =~/"--asciidoc"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:txt_markdown]=(mod.inspect =~/"--markdown"/) \
+ act[:txt_markdown]=(select_arr.inspect \
+ =~/"--markdown"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:txt_rst]=(mod.inspect =~/"--rst"|"--rest"|"--restructuredtext"/) \
+ act[:txt_rst]=(select_arr.inspect \
+ =~/"--rst"|"--rest"|"--restructuredtext"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:manpage]=(cmd =~/i/ \
- || mod.inspect =~/"--manpage"|"--man"/) \
+ act[:manpage]=(select_arr.inspect \
+ =~/"--manpage"|"--man"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:texinfo]=(cmd =~/I/ \
- || mod.inspect =~/"--texinfo"/) \
+ act[:texinfo]=(select_arr.inspect \
+ =~/"--texinfo"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:psql]=if mod.inspect =~/"--pg-\S+"/ \
- or ((mod.inspect =~/"--pg"/) \
- && (mod.inspect \
+ act[:psql]=if select_arr.inspect \
+ =~/"--pg-\S+"/ \
+ or ((select_arr.inspect =~/"--pg"/) \
+ && (select_arr.inspect \
=~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
- act[:psql_createdb]=if mod.inspect \
+ act[:psql_createdb]=if select_arr.inspect \
=~/"--pg-createdb"|"--createdb"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- if mod.inspect \
+ if select_arr.inspect \
=~/"--pg-recreate(?:all)?"|"--recreate(?:all)?"/
act[:psql_drop]={ bool: true, set: :on }
act[:psql_create]={ bool: true, set: :on }
else
- act[:psql_drop]=if mod.inspect \
+ act[:psql_drop]=if select_arr.inspect \
=~/"--pg-dropall"|"--dropall"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:psql_create]=if mod.inspect \
+ act[:psql_create]=if select_arr.inspect \
=~/"--pg-create(?:all)?"|"--create(?:all)?"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
end
- act[:psql_import]=if mod.inspect \
+ act[:psql_import]=if select_arr.inspect \
=~/"--pg-import"|"--import"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:psql_update]=if mod.inspect \
+ act[:psql_update]=if select_arr.inspect \
=~/"--pg-update"|"--update"/
act[:psql_remove]={ bool: true, set: :on }
{ bool: true, set: :on }
else
- act[:psql_remove]=if mod.inspect \
+ act[:psql_remove]=if select_arr.inspect \
=~/"--pg-remove"|"--remove"/
{ bool: true, set: :on }
else
@@ -1028,46 +1249,48 @@ module SiSU_Commandline
{ bool: false, set: :na }
{ bool: false, set: :na }
end
- act[:sqlite]=if (mod.inspect =~/"--sqlite-\S+"/) \
- or ((mod.inspect =~/"--sqlite"/) \
- && (mod.inspect \
- =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
- act[:sqlite_createdb]=if mod.inspect \
+ act[:sqlite]=if select_arr.inspect \
+ =~/"--sqlite-\S+"/ \
+ or (select_arr.inspect \
+ =~/"--sqlite"/ \
+ && select_arr.inspect \
+ =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/)
+ act[:sqlite_createdb]=if select_arr.inspect \
=~/"--sqlite-createdb"|"--createdb"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- if mod.inspect \
+ if select_arr.inspect \
=~/"--sqlite-recreate(?:all)?"|"--recreate(?:all)?"/
act[:sqlite_drop]={ bool: true, set: :on }
act[:sqlite_create]={ bool: true, set: :on }
else
- act[:sqlite_create]=if mod.inspect \
+ act[:sqlite_create]=if select_arr.inspect \
=~/"--sqlite-create(?:all)?"|"--create(?:all)?"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:sqlite_drop]=if mod.inspect \
+ act[:sqlite_drop]=if select_arr.inspect \
=~/"--sqlite-dropall"|"--dropall"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
end
- act[:sqlite_import]=if mod.inspect \
+ act[:sqlite_import]=if select_arr.inspect \
=~/"--sqlite-import"|"--import"/
{ bool: true, set: :on }
else
{ bool: false, set: :na }
end
- act[:sqlite_update]=if mod.inspect \
+ act[:sqlite_update]=if select_arr.inspect \
=~/"--sqlite-update"|"--update"/
act[:sqlite_remove]={ bool: true, set: :on }
{ bool: true, set: :on }
else
- act[:sqlite_remove]=if mod.inspect \
+ act[:sqlite_remove]=if select_arr.inspect \
=~/"--sqlite-remove"|"--sqlite-remove"/
{ bool: true, set: :on }
else
@@ -1091,92 +1314,110 @@ module SiSU_Commandline
{ bool: false, set: :na }
{ bool: false, set: :na }
end
- act[:sqlite_discrete]=mod.inspect =~/"--sql"|"--sqlite"/ \
- && (mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ act[:sqlite_discrete]=select_arr.inspect \
+ =~/"--sql"|"--sqlite"/ \
+ && (select_arr.inspect \
+ !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:harvest]=(mod.inspect =~/"--harvest"/) \
+ act[:harvest]=(select_arr.inspect \
+ =~/"--harvest"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:po4a]=(cmd =~/P/ \
- || mod.inspect =~/"--po4a"|"--pot?"/) \
+ act[:po4a]=(select_arr.inspect \
+ =~/"--po4a"|"--pot?"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:git]=(cmd =~/g/ \
- || mod.inspect =~/"--git"/) \
+ act[:git]=(select_arr.inspect \
+ =~/"--git"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:hash_digests]=(cmd =~/N/ \
- || mod.inspect =~/"--digests?"|"--hash-digests"/) \
+ act[:hash_digests]=(select_arr.inspect \
+ =~/"--digests?"|"--hash-digests"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:pdf_font_size]=if mod.inspect =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/
+ act[:pdf_font_size]=if select_arr.inspect \
+ =~/"--(?:pdf-)?font-?size[=-](\d{1,2})(?:pt)?"/
$1
else :na
end
- act[:pdf_hyperlink_colors]=if mod.inspect =~/"--pdf-hyperlinks-(?:mono(?:chrome)?|no-color)"/
+ act[:pdf_hyperlink_colors]=if select_arr.inspect \
+ =~/"--pdf-hyperlinks-(?:mono(?:chrome)?|no-color)"/
:mono
- elsif mod.inspect =~/"--pdf-hyperlinks-color"/
+ elsif select_arr.inspect \
+ =~/"--pdf-hyperlinks-color"/
:color
else :na
end
- act[:hash_digest_algo]=if mod.inspect =~/"--hash-(?:sha)?512"/
+ act[:hash_digest_algo]=if select_arr.inspect \
+ =~/"--hash-(?:sha)?512"/
:sha512
- elsif mod.inspect =~/"--hash-(?:sha)?256"/
+ elsif select_arr.inspect \
+ =~/"--hash-(?:sha)?256"/
:sha256
- elsif mod.inspect =~/"--hash-md5"/
+ elsif select_arr.inspect \
+ =~/"--hash-md5"/
:md5
else :na
end
- act[:sample_search_form]=(cmd =~/F/ \
- || mod.inspect =~/"--sample-search-form"/) \
+ act[:sample_search_form]=select_arr.inspect \
+ =~/"--sample-search-form"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:webrick]=(cmd =~/W/ \
- || mod.inspect =~/"--webrick"/) \
+ act[:webrick]=select_arr.inspect \
+ =~/"--webrick"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:share_source]=(cmd =~/s/ \
- || mod.inspect =~/"--source"/) \
+ act[:share_source]=select_arr.inspect \
+ =~/"--source"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:sisupod]=(cmd =~/S/ \
- || mod.inspect =~/"--sisupod"/) \
+ act[:sisupod]=select_arr.inspect \
+ =~/"--sisupod"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:scp]=(cmd =~/r/ \
- || mod.inspect =~/"--scp"/) \
+ act[:scp]=select_arr.inspect \
+ =~/"--scp"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:rsync]=(cmd =~/R/ \
- || mod.inspect =~/"--rsync"|"--remote"/) \
+ act[:rsync]=select_arr.inspect \
+ =~/"--rsync"|"--remote"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:zap]=(cmd =~/Z/ \
- || mod.inspect =~/"--zap"|"--delete"/) \
+ act[:zap]=select_arr.inspect \
+ =~/"--zap"|"--delete"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:urls_all]=(cmd =~/U/ \
- || mod.inspect =~/"--urls-all"/) \
+ act[:urls_all]=select_arr.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"/) \
+ act[:urls_selected]=if select_arr.inspect \
+ =~/"--urls"/
+ { bool: true, set: :on }
+ elsif select_arr.inspect \
+ =~/"--harvest/
+ { bool: false, set: :off }
+ elsif select_arr.inspect \
+ =~/"--verbose"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:sitemap]=select_arr.inspect \
+ =~/"--sitemap"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:qrcode]=(cmd =~/Q/ \
- || mod.inspect =~/"--qrcode"/) \
+ act[:qrcode]=select_arr.inspect \
+ =~/"--qrcode"/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:help]=(mod.inspect =~/"--help/) \
+ act[:help]=select_arr.inspect \
+ =~/"--help/ \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:ao]=if (cmd =~/m/ \
- || mod.inspect =~/"--ao"|"--dal"/)
+ act[:ao]=if select_arr.inspect \
+ =~/"--ao"|"--dal"/
{ bool: true, set: :on }
elsif (act[:txt][:set]==:on \
|| act[:txt_textile][:set]==:on \
@@ -1199,6 +1440,13 @@ module SiSU_Commandline
|| act[:share_source][:set]==:on \
|| act[:sisupod][:set]==:on \
|| act[:concordance][:set]==:on \
+ || act[:sqlite_discrete][:set]==:on \
+ || act[:sqlite_import][:set]==:on \
+ || act[:sqlite_update][:set]==:on \
+ || act[:sqlite_remove][:set]==:on \
+ || act[:psql_import][:set]==:on \
+ || act[:psql_update][:set]==:on \
+ || act[:psql_remove][:set]==:on \
|| act[:xml_dom][:set]==:on \
|| act[:xml_sax][:set]==:on \
|| act[:xml_docbook_book][:set]==:on \
@@ -1206,27 +1454,18 @@ module SiSU_Commandline
|| act[:xml_scaffold_structure_sisu][:set]==:on \
|| act[:xml_scaffold_structure_collapse][:set]==:on )
{ bool: true, set: :on }
- #if cmd !~/[mn]/
- # extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
- # and cmd !~/[mn]/
- # 'm' #% add ao
- #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 ao
else
{ bool: false, set: :na }
end
- act[:manifest]=if mod.inspect =~/"--inc-manifest"/
+ act[:manifest]=if select_arr.inspect \
+ =~/"--inc-manifest"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-manifest"/ \
+ elsif select_arr.inspect \
+ =~/"--(?:exc|no)-manifest"/ \
|| act[:switch][:off].inspect =~/"manifest"/
{ bool: false, set: :off }
- elsif (cmd =~/y/ \
- || mod.inspect =~/"--manifest"/)
+ elsif select_arr.inspect \
+ =~/"--manifest"/
{ bool: true, set: :on }
elsif (act[:txt][:set]==:on \
|| act[:txt_textile][:set]==:on \
@@ -1256,71 +1495,55 @@ module SiSU_Commandline
|| act[:xml_scaffold_structure_sisu][:set]==:on \
|| act[:xml_scaffold_structure_collapse][: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[:verbose]=if select_arr.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[:verbose_plus]=if select_arr.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[:version_info]=if select_arr.inspect \
+ =~/"--version"|"--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[:quiet]=if (select_arr.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[:color_state]=if select_arr.inspect =~/"--color-on"|"--color"/
act[:console_messages] << ' --color-on '
{ bool: true, set: :on }
- elsif (cmd =~/k/ \
- || mod.inspect =~/"--color-off"/)
+ elsif (select_arr.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"/
+# act[:color_toggle]=if select_arr.inspect =~/"--color-toggle"/
# true
# else false
# end
- act[:maintenance]=if (cmd =~/M/ \
- || mod.inspect =~/"--maintenance|--keep-processing-files"/)
+ act[:maintenance]=if (select_arr.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[:profile]=if (select_arr.inspect =~/"--profile"/)
act[:console_messages] << ' --color-off '
{ bool: true, set: :on }
else
@@ -1329,11 +1552,17 @@ module SiSU_Commandline
@act=act
end
end
- def cmd
- @cmd
+ def opt_ch
+ @opt_ch
end
- def mod
- @mod
+ def selections
+ def arr
+ @select_arr.sort
+ end
+ def str
+ @select_str ||= arr.join(' ')
+ end
+ self
end
def act
@@act
@@ -1342,6 +1571,9 @@ module SiSU_Commandline
files_mod=files
@files_mod=files_mod
end
+ def files
+ @files
+ end
def f_pth
@f_pth
end