aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/qrcode.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
commitedd89902036bde18c91031470e19c871a182cf6d (patch)
tree1269e7b1660aa64896fc21768002e837233c2c24 /lib/sisu/v5/qrcode.rb
parentv4 v5: version & changelog (diff)
v5: options & downstream, more use of opt.act instead of opt.cmd
* opt.act.*.set==:on instead of opt.cmd =~/\S/
Diffstat (limited to 'lib/sisu/v5/qrcode.rb')
-rw-r--r--lib/sisu/v5/qrcode.rb30
1 files changed, 20 insertions, 10 deletions
diff --git a/lib/sisu/v5/qrcode.rb b/lib/sisu/v5/qrcode.rb
index e0878dd0..bb587f26 100644
--- a/lib/sisu/v5/qrcode.rb
+++ b/lib/sisu/v5/qrcode.rb
@@ -83,12 +83,18 @@ module SiSU_QRcode
@md=SiSU_Param::Parameters.new(@opt).get
xbrowser=@env.program.web_browser
browser=@env.program.console_web_browser
- unless @opt.cmd =~/q/
+ unless @opt.act[:quiet][:set]==:on
url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}"
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"#{xbrowser} #{url_html}").green_hi_blue
- : SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i
+ (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on) \
+ ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'QR code',"#{xbrowser} #{url_html}").green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi
+ if (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],"#{browser} #{url_html}").grey_tab
+ end
end
data=SiSU_HTML::Source::HTML_Environment.new(@particulars).tuned_file_instructions
OutputInfo.new(@md).check_output(data)
@@ -120,17 +126,17 @@ module SiSU_QRcode
def output_metadata
fn=@f.base_filename.manifest_txt
mn=''
- if @md.opt.cmd =~/M/
+ if @md.opt.act[:maintenance][:set]==:on
fn=@f.base_filename.manifest_txt
manifest=@f.write_file.manifest_txt
end
@manifest[:txt].each do |x|
x=x.gsub(/\\\\/m,"\n")
- puts x if @md.opt.cmd =~/V/
- manifest << x if @md.opt.cmd =~/M/
+ puts x if @md.opt.act[:verbose_plus][:set]==:on
+ manifest << x if @md.opt.act[:maintenance][:set]==:on
mn += x
end
- manifest.close if @md.opt.cmd =~/M/
+ manifest.close if @md.opt.act[:maintenance][:set]==:on
cmd=SiSU_Env::SystemCall.new(mn,@f.place_file.qrcode_md.dir,@md.opt.cmd)
cmd.qrencode
end
@@ -163,7 +169,11 @@ WOK
dgst=(@dg =~/^sha(?:2|256)$/) \
? (sys.sha256("#{pth}/#{file}"))
: (sys.md5("#{pth}/#{file}"))
- SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/
+ if (@md.opt.act[:verbose][:set]==:on \
+ || @md.opt.act[:verbose_plus][:set]==:on \
+ || @md.opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn
+ end
size=(File.size("#{pth}/#{file}")/1024.00).to_s
kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1]
@manifest[:txt] <<<<WOK