From a04536559d7ff1a510a0a7aca0c692fd99a88b9b Mon Sep 17 00:00:00 2001 From: Scott Robertson Date: Sat, 18 Aug 2018 00:46:57 +0100 Subject: [PATCH] Ask for teller account --- bin/import | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/import b/bin/import index a1188d8b..42c8f22a 100755 --- a/bin/import +++ b/bin/import @@ -56,7 +56,19 @@ command :teller do |c| c.action do |args, options| raise ArgumentError.new("token is required!") unless options.token raise ArgumentError.new("ynab_account_id is required!") unless options.ynab_account_id - raise ArgumentError.new("teller_account_id is required!") unless options.teller_account_id + + unless options.teller_account_id + accounts = Import::Teller.new(options.token, nil, nil).accounts + accounts.each.with_index do |account, index| + puts "[#{index}] #{account[:institution]} (#{account[:name]})" + end + puts '' + + selected_account = ask("Account ID: ", Integer) + options.teller_account_id = accounts[selected_account][:id] + raise ArgumentError.new("Teller account not found") unless options.teller_account_id + end + Import::Teller.new(options.token, options.teller_account_id, options.ynab_account_id).import end end