mirror of
https://github.com/nishiki/manage-password.git
synced 2025-02-21 10:20:05 +00:00
change editor with var EDITOR
This commit is contained in:
parent
2f627f271c
commit
4b8c87c17f
1 changed files with 4 additions and 1 deletions
|
@ -344,6 +344,7 @@ class Cli
|
||||||
end
|
end
|
||||||
|
|
||||||
def text_editor(template_name, item=nil)
|
def text_editor(template_name, item=nil)
|
||||||
|
editor = ENV['EDITOR'] || 'nano'
|
||||||
options = {}
|
options = {}
|
||||||
opts = {}
|
opts = {}
|
||||||
template_file = "#{File.expand_path('../../../templates', __FILE__)}/#{template_name}.erb"
|
template_file = "#{File.expand_path('../../../templates', __FILE__)}/#{template_name}.erb"
|
||||||
|
@ -356,7 +357,7 @@ class Cli
|
||||||
f << template.result(binding)
|
f << template.result(binding)
|
||||||
end
|
end
|
||||||
|
|
||||||
system("vim #{tmp_file}")
|
system("#{editor} #{tmp_file}")
|
||||||
|
|
||||||
opts = YAML::load_file(tmp_file)
|
opts = YAML::load_file(tmp_file)
|
||||||
end
|
end
|
||||||
|
@ -382,6 +383,8 @@ class Cli
|
||||||
@mpw.sync(true) if @sync
|
@mpw.sync(true) if @sync
|
||||||
|
|
||||||
puts "#{I18n.t('form.add_item.valid')}".green
|
puts "#{I18n.t('form.add_item.valid')}".green
|
||||||
|
rescue Exception => e
|
||||||
|
puts "#{I18n.t('display.error')} #13: #{e}".red
|
||||||
end
|
end
|
||||||
|
|
||||||
# Update an item
|
# Update an item
|
||||||
|
|
Loading…
Add table
Reference in a new issue