aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v6/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v6/options.rb')
-rw-r--r--lib/sisu/v6/options.rb157
1 files changed, 135 insertions, 22 deletions
diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb
index ae641be4..232481c8 100644
--- a/lib/sisu/v6/options.rb
+++ b/lib/sisu/v6/options.rb
@@ -537,6 +537,7 @@ module SiSU_Commandline
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'
@@ -554,8 +555,6 @@ module SiSU_Commandline
when /^--(?:termsheet)$/ then c=c+'T'
when /^--(?:manifest)$/ then c=c+'y'
when /^--(?:qrcode)$/ then c=c+'Q'
- when /^--(?:sqlite)$/ then c=c+'d'
- when /^--(?:pg|pg?sql|postgresql)$/ then c=c+'D'
when /^--(?:remote|rsync)$/ then c=c+'R'
when /^--(?:scp)$/ then c=c+'r'
when /^--(?:source)$/ then c=c+'s'
@@ -587,8 +586,7 @@ module SiSU_Commandline
extra+=if cmd =~/[abegHhIiLNOoPpQTtwXxyz]/ \
and cmd !~/[mn]/
'm' #% add ao
- elsif ((cmd =~/[Dd]/ \
- or (mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/)) \
+ elsif ((mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
and mod.inspect !~/(?:remove|(?:(?:re)?create(?:all)?|dropall|drop)$)/) \
and cmd !~/[mn]/
'm' #% add ao
@@ -596,18 +594,17 @@ module SiSU_Commandline
end
end
if cmd !~/j/
- extra+=if cmd =~/[bHhwXxyz]/ \
+ extra+=if cmd =~/[bdHhwXxyz]/ \
and cmd !~/[j]/
'j' #% copy images
else ''
end
end
if cmd !~/y/
- extra+=if cmd =~/[abeHhIiNopQSstwXxz]/ \
+ extra+=if cmd =~/[abdeHhIiNopQSstwXxz]/ \
and cmd !~/y/
'ym' #% add manifest
- elsif (cmd =~/[Dd]/ \
- or mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/) \
+ elsif mod.inspect =~/--(?:(?:sq)?lite|pg(?:sql)?)/ \
and files[0] !~/^remove$/ \
and cmd !~/y/
'ym' #% add manifest
@@ -916,7 +913,8 @@ module SiSU_Commandline
|| mod.inspect =~/"--xml-dom"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:xml_docbook_book]=mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/ \
+ act[:xml_docbook_book]=(cmd =~/d/ \
+ || mod.inspect =~/"--docbook"|"--docbook-book"|"--xml-docbook"|"--xml-docbook_book"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:xml_fictionbook]=(cmd =~/f/ \
@@ -967,19 +965,134 @@ module SiSU_Commandline
|| mod.inspect =~/"--texinfo"/) \
? { 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_discrete]=(cmd =~/d/ \
- || mod.inspect =~/"--sql"|"--sqlite"/) \
- && (mod.inspect =~/"--both"/ \
- || mod.inspect !~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/) \
+ act[:psql]=if mod.inspect =~/"--pg-\S+"/ \
+ or ((mod.inspect =~/"--pg"/) \
+ && (mod.inspect \
+ =~/"--createdb"|"--create(?:all)?"|"--dropall"|"--recreate(?:all)?"|"--import"|"--update"|"--remove"/))
+ act[:psql_createdb]=if mod.inspect \
+ =~/"--pg-createdb"|"--createdb"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ if mod.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 \
+ =~/"--pg-dropall"|"--dropall"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:psql_create]=if mod.inspect \
+ =~/"--pg-create(?:all)?"|"--create(?:all)?"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ end
+ act[:psql_import]=if mod.inspect \
+ =~/"--pg-import"|"--import"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:psql_update]=if mod.inspect \
+ =~/"--pg-update"|"--update"/
+ act[:psql_remove]={ bool: true, set: :on }
+ { bool: true, set: :on }
+ else
+ act[:psql_remove]=if mod.inspect \
+ =~/"--pg-remove"|"--remove"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ act[:psql_createdb]=
+ { bool: false, set: :na }
+ act[:psql_drop]=
+ { bool: false, set: :na }
+ act[:psql_create]=
+ { bool: false, set: :na }
+ act[:psql_import]=
+ { bool: false, set: :na }
+ act[:psql_update]=
+ { bool: false, set: :na }
+ act[:psql_remove]=
+ { 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 \
+ =~/"--sqlite-createdb"|"--createdb"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ if mod.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 \
+ =~/"--sqlite-create(?:all)?"|"--create(?:all)?"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:sqlite_drop]=if mod.inspect \
+ =~/"--sqlite-dropall"|"--dropall"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ end
+ act[:sqlite_import]=if mod.inspect \
+ =~/"--sqlite-import"|"--import"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ act[:sqlite_update]=if mod.inspect \
+ =~/"--sqlite-update"|"--update"/
+ act[:sqlite_remove]={ bool: true, set: :on }
+ { bool: true, set: :on }
+ else
+ act[:sqlite_remove]=if mod.inspect \
+ =~/"--sqlite-remove"|"--sqlite-remove"/
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ act[:sqlite_createdb]=
+ { bool: false, set: :na }
+ act[:sqlite_drop]=
+ { bool: false, set: :na }
+ act[:sqlite_create]=
+ { bool: false, set: :na }
+ act[:sqlite_import]=
+ { bool: false, set: :na }
+ act[:sqlite_update]=
+ { bool: false, set: :na }
+ act[:sqlite_remove]=
+ { 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"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
act[:harvest]=(mod.inspect =~/"--harvest"/) \