mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-21 10:20:05 +00:00
replace "#{var}" by var.to_s
This commit is contained in:
parent
351499aef6
commit
db6bb2b0f6
2 changed files with 13 additions and 13 deletions
|
@ -40,7 +40,7 @@ class Cli
|
||||||
def set_config(options)
|
def set_config(options)
|
||||||
@config.setup(options)
|
@config.setup(options)
|
||||||
|
|
||||||
puts "#{I18n.t('form.set_config.valid')}".green
|
puts I18n.t('form.set_config.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #15: #{e}".red
|
puts "#{I18n.t('display.error')} #15: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -57,7 +57,7 @@ class Cli
|
||||||
|
|
||||||
load_config
|
load_config
|
||||||
|
|
||||||
puts "#{I18n.t('form.setup_config.valid')}".green
|
puts I18n.t('form.setup_config.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #8: #{e}".red
|
puts "#{I18n.t('display.error')} #8: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -81,7 +81,7 @@ class Cli
|
||||||
|
|
||||||
@config.setup_gpg_key(@password, gpg_key)
|
@config.setup_gpg_key(@password, gpg_key)
|
||||||
|
|
||||||
puts "#{I18n.t('form.setup_gpg_key.valid')}".green
|
puts I18n.t('form.setup_gpg_key.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #8: #{e}".red
|
puts "#{I18n.t('display.error')} #8: #{e}".red
|
||||||
exit 2
|
exit 2
|
||||||
|
@ -208,7 +208,7 @@ class Cli
|
||||||
end
|
end
|
||||||
|
|
||||||
print '| '
|
print '| '
|
||||||
print "#{item.send(k.to_s)}".send(v[:color])
|
print item.send(k.to_s).to_s.send(v[:color])
|
||||||
(v[:length] - item.send(k.to_s).to_s.length).times { print ' ' }
|
(v[:length] - item.send(k.to_s).to_s.length).times { print ' ' }
|
||||||
end
|
end
|
||||||
print "\n"
|
print "\n"
|
||||||
|
@ -343,7 +343,7 @@ class Cli
|
||||||
@mpw.add_key(key)
|
@mpw.add_key(key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts "#{I18n.t('form.add_key.valid')}".green
|
puts I18n.t('form.add_key.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||||
end
|
end
|
||||||
|
@ -354,7 +354,7 @@ class Cli
|
||||||
@mpw.delete_key(key)
|
@mpw.delete_key(key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts "#{I18n.t('form.delete_key.valid')}".green
|
puts I18n.t('form.delete_key.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #15: #{e}".red
|
puts "#{I18n.t('display.error')} #15: #{e}".red
|
||||||
end
|
end
|
||||||
|
@ -403,7 +403,7 @@ class Cli
|
||||||
@mpw.set_otp_key(item.id, options[:otp_key]) if options.key?(:otp_key)
|
@mpw.set_otp_key(item.id, options[:otp_key]) if options.key?(:otp_key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts "#{I18n.t('form.add_item.valid')}".green
|
puts I18n.t('form.add_item.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #13: #{e}".red
|
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||||
end
|
end
|
||||||
|
@ -428,7 +428,7 @@ class Cli
|
||||||
@mpw.set_otp_key(item.id, options[:otp_key]) if options.key?(:otp_key)
|
@mpw.set_otp_key(item.id, options[:otp_key]) if options.key?(:otp_key)
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts "#{I18n.t('form.update_item.valid')}".green
|
puts I18n.t('form.update_item.valid').to_s.green
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #14: #{e}".red
|
puts "#{I18n.t('display.error')} #14: #{e}".red
|
||||||
|
@ -452,7 +452,7 @@ class Cli
|
||||||
item.delete
|
item.delete
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts "#{I18n.t('form.delete_item.valid')}".green
|
puts I18n.t('form.delete_item.valid').to_s.green
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #16: #{e}".red
|
puts "#{I18n.t('display.error')} #16: #{e}".red
|
||||||
|
@ -501,7 +501,7 @@ class Cli
|
||||||
|
|
||||||
File.open(file, 'w') {|f| f << data.to_yaml}
|
File.open(file, 'w') {|f| f << data.to_yaml}
|
||||||
|
|
||||||
puts "#{I18n.t('form.export.valid', file: file)}".green
|
puts I18n.t('form.export.valid', file: file).to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #17: #{e}".red
|
puts "#{I18n.t('display.error')} #17: #{e}".red
|
||||||
end
|
end
|
||||||
|
@ -530,7 +530,7 @@ class Cli
|
||||||
|
|
||||||
@mpw.write_data
|
@mpw.write_data
|
||||||
|
|
||||||
puts "#{I18n.t('form.import.valid')}".green
|
puts I18n.t('form.import.valid').to_s.green
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "#{I18n.t('display.error')} #18: #{e}".red
|
puts "#{I18n.t('display.error')} #18: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
|
@ -104,9 +104,9 @@ class Config
|
||||||
# @rtrn: true if the GPG key is create, else false
|
# @rtrn: true if the GPG key is create, else false
|
||||||
def setup_gpg_key(password, name, length = 4096, expire = 0)
|
def setup_gpg_key(password, name, length = 4096, expire = 0)
|
||||||
if name.to_s.empty?
|
if name.to_s.empty?
|
||||||
raise "#{I18n.t('error.config.genkey_gpg.name')}"
|
raise I18n.t('error.config.genkey_gpg.name')
|
||||||
elsif password.to_s.empty?
|
elsif password.to_s.empty?
|
||||||
raise "#{I18n.t('error.config.genkey_gpg.password')}"
|
raise I18n.t('error.config.genkey_gpg.password')
|
||||||
end
|
end
|
||||||
|
|
||||||
param = ''
|
param = ''
|
||||||
|
|
Loading…
Add table
Reference in a new issue