Improve text output for users

This commit is contained in:
Martin Puppe 2020-03-25 17:53:59 +01:00
parent 6388495fc7
commit ee2e4d7129

View file

@ -34,6 +34,7 @@ if !Pathname.new(config_file).exist? then
end
def do_backup(config)
puts "Applying configuration #{config['name']} …"
ENV['RESTIC_REPOSITORY'] = config['repository']
ENV['RESTIC_PASSWORD'] = STDIN.getpass('Please put in your restic password: ')
@ -75,9 +76,11 @@ def do_backup(config)
ENV.delete('RESTIC_PASSWORD')
end
puts "Using config file #{config_file} …"
configs = YAML.load_stream(File.open(config_file))
if ARGV.empty?
puts "No configuration name has been given. Using the first configuration."
puts "No configuration name has been given. Will use the first "\
"configuration from the file (#{configs.dig(0, 'name')})."
do_backup(configs[0])
else
ARGV.each do |config_name|