aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-04-19 21:33:45 -0400
committerRalph Amissah <ralph@amissah.com>2011-04-19 21:33:45 -0400
commit17d1555cfcfbbcd1b0a83ace1e264152c71ebd2f (patch)
treee15ecdb72c6bf23effeaf4ea31941d6694e5ae8f
parentv3: urls, minor fixes (diff)
v3: options, hub, introduce opt.act booleans, more setting in options
* opt.act booleans more flexible than opt.cmd (start to favor use of opt.act over opt.cmd) * move option setting from hub to options where possible * separate out a few methods
-rw-r--r--data/doc/sisu/CHANGELOG_v313
-rw-r--r--lib/sisu/v3/hub.rb156
-rw-r--r--lib/sisu/v3/options.rb356
3 files changed, 380 insertions, 145 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 6af9b0d2..b584eee7 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -20,15 +20,22 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.7.orig.tar.gz
sisu_3.0.7-1.dsc
sisu_3.0.7-1.debian.tar.gz
- * options, maintenance -M (--maintenance, new alias --keep-processing-files)
- * new alias --keep-processing-files (see Bug#622902)
- * minor rearrangement of regex
+ * options
+ * new alias (for -M / --maintenance) --keep-processing-files (see Bug#622902)
+ * introduce opt.act booleans made up of opt.cmd and opt.mod, more flexible
+ than overused cmd characters
+ * where possible move option setting from hub to options
+ * separate out a few methods
* odf:odt
* maintenance, processing in separate subdirectories, that can be
kept
* odt.zip (bin) directory renamed odt from odf
+ * hub
+ * some option setting moved to options
+ * favor use of opt.act over opt.cmd where appropriate
+
* sysenv, odf:odt paths adjusted for changes in maintenance and odt.zip
* cgi, sample-search-form
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index 7794c08c..e20b4293 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -287,58 +287,28 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
if @opt.cmd =~/E/ # re-assign character
require 'profile'
end
- if @opt.mod.inspect =~/--harvest/
+ if @opt.act[:harvest]
require_relative 'harvest' # harvest.rb
- end
- if @opt.mod.inspect =~/--convert|--to|--from/
+ elsif @opt.mod.inspect =~/--convert|--to|--from/
require_relative 'sst_convert_markup' # sst_convert_markup.rb
- end
- if @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \
+ elsif @opt.cmd =~/([AabCcDdeFfGgHhIiJjkLMmNnOoPpQqRrSsTtUuVvwWXxYyZ_0-9])/ \
and @opt.cmd =~/^-/ \
and @opt.mod.inspect !~/--(?:sitemaps|query|identify)/ \
or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/
@@tell=SiSU_Screen::Ansi.new(@opt.cmd)
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
flag=SiSU_Env::Info_processing_flag.new
- extra=''
- if @opt.cmd !~/[mn]/
- extra+=if @opt.cmd =~/[abegHhIiNOoPpTtwXxyz]/ \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- elsif ((@opt.cmd =~/[Dd]/ \
- or (@opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
- and @opt.mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
- and @opt.cmd !~/[mn]/
- 'm' #% add dal
- else ''
- end
- end
- if @opt.cmd !~/y/
- extra+=if @opt.cmd =~/[abeHhIiNopsSstwXxz]/ \
- and @opt.cmd !~/y/
- 'ym' #% add manifest
- elsif (@opt.cmd =~/[Dd]/ \
- or @opt.mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
- and @opt.files[0] !~/^remove$/ \
- and @opt.cmd !~/y/
- 'ym' #% add manifest
- else ''
- end
- end
- @opt.cmd=@opt.cmd + extra
- opt=@opt.cmd.scan(/CC|\S/)
- @opt.cmd=opt.uniq.join
- if @opt.cmd =~/[vVM]/ #% version information
+ if @opt.cmd =~/[vVM]/ #% version information
if @opt.cmd =~/V/ \
- and @opt.files.empty? #% environment
+ and @opt.files.empty? #% environment
SiSU_Help::Help.new('env',@opt).environment
else SiSU_Help::Help.new('env',@opt).sisu_version
end
end
- if @opt.cmd =~/^-L$/ #% version information
+ if @opt.act[:license] #% license information
SiSU_Help::Help.new('license',@opt).help_request
end
- if @opt.cmd =~/m/i #% -m for -C
+ if @opt.act[:dal] or @opt.act[:maintenance] #% --maintenance, -m for -C
path={}
path[:css]=@@env.path.output + '/_sisu/css'
path[:xml]=@@env.path.output + '/_sisu/xml'
@@ -356,7 +326,7 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
end
end
- if @opt.cmd =~/C/ #% -C initialize/configure
+ if @opt.act[:site_init] #% --init-site, -C initialize/configure
op('conf','configure site')
if @opt.cmd =~/R/
if @opt.mod.inspect =~/--init(?:ialize)?=site/ \
@@ -372,19 +342,19 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
end
end
- if @opt.cmd =~/F/ #% -F cgi sample search form
+ if @opt.act[:sample_search_form] #% --sample-search-form, -F cgi sample search form
Operations.new(@opt).cgi
end
- if @opt.cmd =~/W/ #% -W webrick #@argv==port
+ if @opt.act[:webrick] #% --webrick, -W webrick
Operations.new(@opt).webrick
end
- if @opt.cmd =~/Z/ #% -Z wipe previous output clean
+ if @opt.cmd =~/Z/ #% -Z wipe previous output clean
op('zap','Zap, deletions')
end
- if @opt.cmd =~/s/ #% -s sisu source
+ if @opt.act[:share_source]
op('share_src','SiSU markup source')
end
- if @opt.cmd =~/m/ #% -m is remote url requested? (download if)
+ if @opt.act[:dal]
@retry_count= -1
begin
path_image='./_sisu/processing/external_document/image'
@@ -400,12 +370,12 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
@get_p << re_p.match(fns)[1] if re_p
end
end
- if @get_s.length > 0 #% remote markup file .sst
+ if @get_s.length > 0 #% remote markup file .sst
require_relative 'remote' # remote.rb
SiSU_Remote::Get.new(@opt,@get_s).fns
Operations.new.counter
end
- if @get_p.length > 0 #% remote sisupod
+ if @get_p.length > 0 #% remote sisupod
require_relative 'remote' # remote.rb
SiSU_Remote::Get.new(@opt,@get_p).sisupod
end
@@ -417,48 +387,57 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
@opt.files=@opt.files.collect {|x| x=x.gsub(/(?:https?|file):\/\/\S+\/(\S+)\.sst$/,'\1.-sst') }
end
- if @opt.cmd=~/m/ #% -m dal
+ if @opt.act[:dal] #%--dal, -m
op('dal','dal')
end
@opt.files=@opt.files.collect {|x| x=x.gsub(/\.ssm$/,'.ssm.sst') }
- if @opt.cmd =~/S/
- op('sisupod_make','sisupod (zip)') #% -S make sisupod
+ if @opt.act[:sisupod] #% --sisupod, -S make sisupod
+ op('sisupod_make','sisupod (zip)')
if @opt.fns=~/\.kdi._sst/
- op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source
+ op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source
end
end
- if @opt.cmd =~/N/; op('digests','digests') #% -N digest tree
+ if @opt.act[:hash_digests] #% --hash-digests, -N digest tree
+ op('digests','digests')
end
- if @opt.cmd =~/[hHz]/; op('html','html') #% -h -H -z html css
+ if @opt.act[:html] #% --html, -h
+ op('html','html')
end
- if @opt.cmd =~/[at]/; op('plaintext','plaintext') #% -t -a #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file
+ if @opt.act[:txt] #% --txt, -t -a
+ #-A -f -e -E plaintext -a creates ms-dos type; -A creates unix type, plaintext file
+ op('plaintext','plaintext')
end
- #if @opt.cmd =~/g/; op('git','git') #% -g git
- #end
- #if @opt.cmd =~/g/; op('wikispeak','wikispeak') #% -g wiki
- #end
- if @opt.cmd =~/e/; op('epub','ePub') #% -e epub
+ if @opt.act[:epub] #% --epub, -e
+ op('epub','ePub')
end
- if @opt.cmd =~/o/; op('odf','OpenDocument') #% -o opendocument
+ if @opt.act[:odt] #% --odt, -o opendocument
+ op('odf','OpenDocument')
end
- if @opt.cmd =~/x/; op('xml','xml sax') #% -x xml sax type
+ if @opt.act[:xml_sax] #% --xml-sax, -x xml sax type
+ op('xml','xml sax')
end
- if @opt.cmd =~/X/; op('xml_dom','xml dom') #% -X xml dom type
+ if @opt.act[:xml_dom] #% --xml-dom, -x xml dom type
+ op('xml_dom','xml dom')
end
- if @opt.cmd =~/f/; op('xml_fictionbook','xml fictionbook') #% -f xml fictionbook
+ if @opt.act[:fictionbook] #% --fictionbook, -f fictionbook xml
+ op('xml_fictionbook','xml fictionbook')
end
- if @opt.cmd =~/b/; op('xhtml','xhtml sax') #% -b xhtml sax type
+ if @opt.act[:xhtml] #% --xhtml, -b xhtml
+ op('xhtml','xhtml sax')
end
- if @opt.cmd =~/w/; op('concordance','Concordance') #% -w concordance
+ if @opt.act[:concordance] #% --concordance, -w
+ op('concordance','Concordance')
end
- if @opt.cmd =~/O/; op('xml_md_oai_pmh_dc','OAI PMH') #% -O open archive initiative, metadata harvesting
+ if @opt.cmd =~/O/ #% -O open archive initiative, metadata harvesting
+ op('xml_md_oai_pmh_dc','OAI PMH')
end
- if @opt.cmd =~/P/; op('po4a','po4a') #% -P
+ if @opt.act[:po4a] #% --po4a, -P
+ op('po4a','po4a')
end
- if @opt.cmd =~/g/ #% -g sisu git
+ if @opt.act[:git] #% --git, -g sisu git
op('git','SiSU Git')
end
- if @opt.cmd =~/T/ #% -T termsheet/standard form
+ if @opt.cmd =~/T/ #% -T termsheet/standard form
SiSU_Help::Help.new('termsheet').help_request
@opt.files.each do |fns|
if FileTest.file?(fns)
@@ -472,32 +451,39 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
end
Operations.new.counter
end
- if @opt.cmd =~/k/; op('xml_scaffold','XML scaffold') #% -T temporary tests
+ if @opt.cmd =~/k/ #% -T temporary tests
+ op('xml_scaffold','XML scaffold')
end
- if @opt.cmd =~/p/; op('texpdf','LaTeX pdf') #% -p latex/ texpdf
+ if @opt.act[:pdf] #% --pdf, -p latex/ texpdf
+ op('texpdf','LaTeX pdf')
end
- if @opt.cmd =~/i/; op('manpage','manpage') #% -i manpage
+ if @opt.act[:manpage] #% --manpage, -i
+ op('manpage','manpage')
end
- if @opt.cmd =~/I/; op('texinfo','TeX Info') #% -I texinfo (i taken by db import)
+ if @opt.act[:texinfo] #% --texinfo, -I
+ op('texinfo','TeX Info')
end
- if @opt.cmd =~/D/ \
- or @opt.mod.inspect =~/--pgsql/; op('dbi','postgresql') #% -D DB postgresql
+ if @opt.act[:psql] #% --pg, -D DB postgresql
+ op('dbi','postgresql')
end
- if @opt.cmd =~/d/ \
- or @opt.mod.inspect =~/--sqlite/; op('dbi','sqlite') #% -d DB sqlite
+ if @opt.act[:sqlite] #% --sqlite, -d DB sqlite
+ op('dbi','sqlite')
end
- #if @opt.cmd =~/G/; Operations.new(@opt).cgi #% -G cgi - used to make dbi intecface
- #end
- if @opt.cmd=~/m/; op('embedded','Embedded Content') #% -m embedded content
+ if @opt.act[:dal] #% --dal, -m embedded content
+ op('embedded','Embedded Content')
end
- if @opt.cmd =~/y/; op('manifest','Manifest') #% -y manifest
+ if @opt.act[:manifest] #% --manifest, -y
+ op('manifest','Manifest')
end
- if @opt.cmd =~/Y/; op('sitemaps','Sitemap') #% -Y sitemap
+ if @opt.act[:sitemap] #% --sitemap, -Y
+ op('sitemaps','Sitemap')
end
if @opt.mod.inspect !~/--harvest/
- if @opt.cmd =~/r/; op('remote','scp') #% -r copy to remote server
+ if @opt.act[:scp] #% -r copy to remote server
+ op('remote','scp')
end
- if @opt.cmd =~/R/; op('remote','rsync') #% -R copy to remote server
+ if @opt.act[:rsync] #% -R copy to remote server
+ op('remote','rsync')
end
else
end
@@ -517,20 +503,20 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
elsif @opt.mod.inspect =~/--identify/
require_relative 'sst_identify_markup' # sst_identify_markup.rb
markup_version=SiSU_Markup::Markup_identify.new(@opt).markup_version?
- elsif @opt.mod.inspect =~/--about/ #% help instructions
+ elsif @opt.mod.inspect =~/--about/ #% help instructions
if @opt.mod.inspect =~/--about/ \
and not @opt.what.empty?
SiSU_Help::Help.new(@opt.what,'color_off').help_request
else SiSU_Help::Help.new('list','color_off').help_request
end
- elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
+ elsif @opt.mod.inspect =~/--sitemaps/ #% sitemaps
require_relative 'sitemaps' # sitemaps.rb
SiSU_Sitemaps::Source.new(@opt).read
if @opt.cmd =~/R/
require_relative 'remote' # remote.rb
SiSU_Remote::Put.new(@opt).rsync_sitemaps
end
- else #% help instructions
+ else #% help instructions
unless @opt.mod.inspect =~/--convert|--to|--from|--harvest/
if @opt.mod.inspect =~/--help/ \
and not @opt.what.empty?
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index 89efb0a6..a1a448e6 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -61,11 +61,11 @@ module SiSU_commandline
require "pathname"
require_relative 'sysenv' # sysenv.rb
class Options
- attr_accessor :cmd,:mod,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:what
+ attr_accessor :cmd,:mod,:act,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what
def initialize(a)
@a=a
@cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what='','','','','','','','',''
- @f_pths,@files,@paths,@mod=[],[],[],[]
+ @f_pths,@files,@paths,@mod,@act=Array.new(5){[]}
@env=SiSU_Env::Info_env.new
r=Px[:lng_lst].join('|')
#r.gsub!(/\|en\|/,'|')
@@ -102,44 +102,27 @@ module SiSU_commandline
end
def init
a=@a
- c,w,s='','',''
- m,f,pth,z,ca=[],[],[],[],[]
- shortcut=SiSU_Env::Info_processing_flag.new
- a.each do |x|
- y=case x
- when /0/
- (x=~/^-1\S+/) \
- ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \
- : x.gsub(/^-0/,shortcut.cf_0 + ' ')
- when /1/
- (x=~/^-1\S+/) \
- ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \
- : x.gsub(/^-1/,shortcut.cf_1 + ' ')
- when /2/
- (x=~/^-2\S+/) \
- ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \
- : x.gsub(/^-2/,shortcut.cf_2 + ' ')
- when /3/
- (x=~/^-3\S+/) \
- ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \
- : x.gsub(/^-3/,shortcut.cf_3 + ' ')
- when /4/
- (x=~/^-4\S+/) \
- ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \
- : x.gsub(/^-4/,shortcut.cf_4 + ' ')
- when /5/
- (x=~/^-5\S+/) \
- ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \
- : x.gsub(/^-5/,shortcut.cf_5 + ' ')
- when /6/
- (x=~/^-6\S+/) \
- ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \
- : x.gsub(/^-6/,shortcut.cf_5 + ' ')
- else x
- end
- s << " #{y}" unless y.empty?
+ 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])
+ @what=q[:what] unless q[:what].empty?
+ @paths = q[:paths]
+ @files = q[:files]
+ @f_pths = q[:f_pths]
+ if @files.length > 0 \
+ and @cmd.empty? \
+ and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default
+ @cmd=shortcut.cf_0
end
- s.strip!
+ SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/
+# @files.uniq!
+ @act=opt_act
+ @files
+ self
+ end
+ def set_files_and_paths_and_general_extract(s)
+ c,w='',''
+ m,f,pth,z,lng=[],[],[],[],[]
a=s.split(/\s+/)
a.each do |x|
if x =~/^-[a-z0-5]+/i \
@@ -157,6 +140,10 @@ module SiSU_commandline
f << pt.split[1].to_s #remove?
u=/.+?\/([^\/]+)(?:(?:\/(?:en|fr|es)$)|$)/
t=/.+\/(en|fr|es)/
+ lng << (pt.split[0].realpath.to_s[t,1]) \
+ ? pt.split[0].realpath.to_s[t,1] \
+ : nil
+ #: ''
f_pths << {
pth: pt.split[0].realpath.to_s,
f: pt.split[1].to_s,
@@ -176,6 +163,49 @@ module SiSU_commandline
puts "#{x} in #{a.join(' ')}?"
end
end
+ { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng }
+ end
+ def expand_numeric_shortcuts(a)
+ shortcut=SiSU_Env::Info_processing_flag.new
+ s=''
+ a.each do |x|
+ y=case x
+ when /0/
+ (x=~/^-1\S+/) \
+ ? x.gsub(/^-0(\S+)/,shortcut.cf_0 + ' -\1') \
+ : x.gsub(/^-0/,shortcut.cf_0 + ' ')
+ when /1/
+ (x=~/^-1\S+/) \
+ ? x.gsub(/^-1(\S+)/,shortcut.cf_1 + ' -\1') \
+ : x.gsub(/^-1/,shortcut.cf_1 + ' ')
+ when /2/
+ (x=~/^-2\S+/) \
+ ? x.gsub(/^-2(\S+)/,shortcut.cf_2 + ' -\1') \
+ : x.gsub(/^-2/,shortcut.cf_2 + ' ')
+ when /3/
+ (x=~/^-3\S+/) \
+ ? x.gsub(/^-3(\S+)/,shortcut.cf_3 + ' -\1') \
+ : x.gsub(/^-3/,shortcut.cf_3 + ' ')
+ when /4/
+ (x=~/^-4\S+/) \
+ ? x.gsub(/^-4(\S+)/,shortcut.cf_4 + ' -\1') \
+ : x.gsub(/^-4/,shortcut.cf_4 + ' ')
+ when /5/
+ (x=~/^-5\S+/) \
+ ? x.gsub(/^-5(\S+)/,shortcut.cf_5 + ' -\1') \
+ : x.gsub(/^-5/,shortcut.cf_5 + ' ')
+ when /6/
+ (x=~/^-6\S+/) \
+ ? x.gsub(/^-6(\S+)/,shortcut.cf_5 + ' -\1') \
+ : x.gsub(/^-6/,shortcut.cf_5 + ' ')
+ 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
unless m.empty?
m.each do |m|
case m
@@ -217,31 +247,237 @@ module SiSU_commandline
end
end
end
+ ca=[]
unless c.empty?
c.gsub!(/-/,'')
c.scan(/CC|\S/) {|x| ca << x}
- @cmd= '-' + ca.uniq.join
+ cmd= '-' + ca.uniq.join
end
- unless w.empty? ; @what=w
- end
- @paths = pth
- @files = f
- @f_pths = f_pths
- if @files.length > 0 \
- and @cmd.empty? \
- and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default
- @cmd=shortcut.cf_0
+ extra=''
+ if cmd !~/[mn]/
+ extra+=if cmd =~/[abegHhIiNOoPpTtwXxyz]/ \
+ and cmd !~/[mn]/
+ 'm' #% add dal
+ elsif ((cmd =~/[Dd]/ \
+ or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
+ and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
+ and cmd !~/[mn]/
+ 'm' #% add dal
+ else ''
+ end
end
- SiSU_Screen::Ansi.new(@cmd,"\tsisu " + @cmd + ' ' + @mod.join(' ') + ' ' + @files.join(' ') + "\n").print_brown if @cmd =~/[vVM]/
-# @files.uniq!
- @fa=[]
- @files.each do |f|
- if f =~/\.sst$/
- elsif f =~/\.ssm$/
+ if cmd !~/y/
+ extra+=if cmd =~/[abeHhIiNopsSstwXxz]/ \
+ and cmd !~/y/
+ 'ym' #% add manifest
+ elsif (cmd =~/[Dd]/ \
+ or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
+ and files[0] !~/^remove$/ \
+ and cmd !~/y/
+ 'ym' #% add manifest
+ else ''
end
end
- @files
- self
+ cmd=cmd + extra
+ cmds=cmd.scan(/CC|\S/)
+ [cmds.uniq.join,mod]
+ end
+ 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[:color_state]=if mod.inspect =~/"--color-on"|"--color"/
+ true
+ elsif mod.inspect =~/"--color-off"/
+ true
+ else 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[: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 mod.inspect =~/"--po4a"|"--po"/
+ 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[:manifest]=if cmd =~/y/ \
+ or mod.inspect =~/"--manifest"/
+ true
+ else false
+ end
+ act[:help]=if mod.inspect =~/"--help/
+ true
+ else false
+ end
+ @act=act
end
def cmd
@cmd
@@ -249,12 +485,18 @@ module SiSU_commandline
def mod
@mod
end
+ def act
+ @act
+ end
def f_pth
@f_pth
end
def pth
@pth
end
+ def lng
+ @lng
+ end
def fns
@fns
end