lib/imap/backup/setup/account.rb in imap-backup-7.0.0.rc1 vs lib/imap/backup/setup/account.rb in imap-backup-7.0.2
- old
+ new
@@ -36,10 +36,11 @@
header menu
modify_email menu
modify_password menu
modify_backup_path menu
choose_folders menu
+ toggle_mirror_mode menu
modify_multi_fetch_size menu
modify_server menu
modify_connection_options menu
toggle_reset_seen_flags_after_fetch menu
test_connection menu
@@ -77,10 +78,18 @@
menu.choice("choose backup folders") do
Setup::FolderChooser.new(account).run
end
end
+ def toggle_mirror_mode(menu)
+ menu_item = "toggle mode (keep/mirror)"
+ new_value = account.mirror_mode ? nil : true
+ menu.choice(menu_item) do
+ account.mirror_mode = new_value
+ end
+ end
+
def modify_multi_fetch_size(menu)
menu.choice("modify multi-fetch size (number of emails to fetch at a time)") do
size = highline.ask("size: ")
int = size.to_i
account.multi_fetch_size = int if int.positive?
@@ -94,10 +103,18 @@
end
end
def modify_connection_options(menu)
menu.choice("modify connection options") do
- connection_options = highline.ask("connections options (as JSON): ")
+ default =
+ if account.connection_options
+ account.connection_options.to_json
+ else
+ ""
+ end
+ connection_options = highline.ask("connections options (as JSON): ") do |q|
+ q.default = default
+ end
if !connection_options.nil?
begin
account.connection_options = connection_options
rescue JSON::ParserError
Kernel.puts "Malformed JSON, please try again"