From edd89902036bde18c91031470e19c871a182cf6d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 23 Oct 2013 23:40:45 -0400 Subject: v5: options & downstream, more use of opt.act instead of opt.cmd * opt.act.*.set==:on instead of opt.cmd =~/\S/ --- lib/sisu/v5/db_select.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/sisu/v5/db_select.rb') diff --git a/lib/sisu/v5/db_select.rb b/lib/sisu/v5/db_select.rb index 879862b1..38251554 100644 --- a/lib/sisu/v5/db_select.rb +++ b/lib/sisu/v5/db_select.rb @@ -94,7 +94,7 @@ module SiSU_DbSelect file=if @opt.inspect =~/M/ if @opt.fns and not @opt.fns.empty? @env=SiSU_Env::InfoEnv.new(@opt.fns) if @opt.fns - puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.cmd =~/M/ + puts "\n#{@env.processing_path.sqlite}/#{@opt.fns}.sql" if @sql_type =~/sqlite/ and @opt.act[:maintenance][:set]==:on @db=SiSU_Env::InfoDb.new @job="sqlite3 #{@db.sqlite.db} < #{@env.processing_path.sqlite}/#{@opt.fns}.sql" File.new("#{@env.processing_path.sqlite}/#{@opt.fns}.sql",'w+') @@ -172,21 +172,21 @@ module SiSU_DbSelect db_exist? @sdb_import.marshal_load tell=case @sql_type - when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?") - when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?") + when /sqlite/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") + when /pg/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") else '???' end - tell.puts_grey if @opt.cmd =~/v/ + tell.puts_grey if @opt.act[:verbose][:set]==:on when /^--update$/ db_exist? @sdb_remove_doc.remove @sdb_import.marshal_load tell=case @sql_type - when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?") - when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?") + when /sqlite/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"sqlite3 #{@db.sqlite.db} database?") + when /pg/; SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"pgaccess or psql #{@db.psql.db} database?") else '???' end - tell.puts_grey if @opt.cmd =~/v/ + tell.puts_grey if @opt.act[:verbose][:set]==:on when /^--remove$/ db_exist? @sdb_remove_doc.remove @@ -206,14 +206,14 @@ module SiSU_DbSelect when /^--(?:v\d+|dev)$/ else end - if @opt.cmd =~/M/ \ + if @opt.act[:maintenance][:set]==:on \ and @opt.cmd =~/d/ puts @job end end if @opt.act[:psql][:set]==:on \ and @opt.mod.inspect !~/--(?:createdb|init(?:ialize)?|create(?:all)?|createtables?|recreate|cr(eate)?lex|cr(eate)?metadata|import|update|remove|index|droptable(s)?|dropindex(es)?|dropall|drop)/ - SiSU_Screen::Ansi.new(@opt.cmd,"--pg requires further instruction").warn unless @opt.cmd =~/[q]/ + SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"--pg requires further instruction").warn unless @opt.act[:quiet][:set]==:on end begin rescue; @sdb.output_dir? -- cgit v1.2.3