Use ENV['MASTER_KEY'] if defined

master
Guillaume Dott 2014-10-22 10:41:15 +02:00
parent 579ff101ca
commit dd9e6312e2
2 changed files with 13 additions and 10 deletions

View File

@ -15,16 +15,7 @@ class Twik
end
def run
masterkey = ask('Master key: ')
puts twik.generate(config.tag, masterkey)
end
def ask(prompt)
print prompt
res = STDIN.noecho(&:gets).chomp
puts
res
puts twik.generate(config.tag, config.masterkey)
end
end
end

View File

@ -28,6 +28,18 @@ class Twik
@yaml = YAML.load_file(file.path)
end
def ask(prompt)
print prompt
res = STDIN.noecho(&:gets).chomp
puts
res
end
def masterkey
ENV['MASTER_KEY'] || ask('Master key: ')
end
def profile
args['profile'] || 'default'
end