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
|
end
|
||||||
|
|
||||||
# Create a new config file
|
# Create a new config file
|
||||||
# @args: lang -> the software language
|
# @args: language -> the software language
|
||||||
def setup(lang)
|
def setup(language)
|
||||||
puts I18n.t('form.setup_config.title')
|
@config.is_valid?
|
||||||
puts '--------------------'
|
|
||||||
language = ask(I18n.t('form.setup_config.lang', lang: lang)).to_s
|
options = text_editor('setup_form', language)
|
||||||
key = ask(I18n.t('form.setup_config.gpg_key')).to_s
|
language = options[:language] || language
|
||||||
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
|
|
||||||
|
|
||||||
if language.nil? or language.empty?
|
|
||||||
language = lang
|
|
||||||
end
|
|
||||||
I18n.locale = language.to_sym
|
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?
|
raise I18n.t('error.config.check') if not @config.is_valid?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue