mirror of
https://github.com/nishiki/manage-password.git
synced 2025-03-19 12:59:30 +00:00
new setup form
This commit is contained in:
parent
dd9f2853ce
commit
e7956b2006
1 changed files with 7 additions and 12 deletions
|
@ -41,21 +41,16 @@ class Cli
|
|||
end
|
||||
|
||||
# Create a new config file
|
||||
# @args: lang -> the software language
|
||||
def setup(lang)
|
||||
puts I18n.t('form.setup_config.title')
|
||||
puts '--------------------'
|
||||
language = ask(I18n.t('form.setup_config.lang', lang: lang)).to_s
|
||||
key = ask(I18n.t('form.setup_config.gpg_key')).to_s
|
||||
wallet_dir = ask(I18n.t('form.setup_config.wallet_dir', home: "#{@config.config_dir}")).to_s
|
||||
gpg_exe = ask(I18n.t('form.setup_config.gpg_exe')).to_s
|
||||
# @args: language -> the software language
|
||||
def setup(language)
|
||||
@config.is_valid?
|
||||
|
||||
options = text_editor('setup_form', language)
|
||||
language = options[:language] || language
|
||||
|
||||
if language.nil? or language.empty?
|
||||
language = lang
|
||||
end
|
||||
I18n.locale = language.to_sym
|
||||
|
||||
@config.setup(key, lang, wallet_dir, gpg_exe)
|
||||
@config.setup(options[:gpg_key], language, options[:wallet_dir], options[:gpg_exe])
|
||||
|
||||
raise I18n.t('error.config.check') if not @config.is_valid?
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue