Skip to content

Commit a045365

Browse files
Ask for teller account
1 parent e7da17b commit a045365

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/import

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,19 @@ command :teller do |c|
5656
c.action do |args, options|
5757
raise ArgumentError.new("token is required!") unless options.token
5858
raise ArgumentError.new("ynab_account_id is required!") unless options.ynab_account_id
59-
raise ArgumentError.new("teller_account_id is required!") unless options.teller_account_id
59+
60+
unless options.teller_account_id
61+
accounts = Import::Teller.new(options.token, nil, nil).accounts
62+
accounts.each.with_index do |account, index|
63+
puts "[#{index}] #{account[:institution]} (#{account[:name]})"
64+
end
65+
puts ''
66+
67+
selected_account = ask("Account ID: ", Integer)
68+
options.teller_account_id = accounts[selected_account][:id]
69+
raise ArgumentError.new("Teller account not found") unless options.teller_account_id
70+
end
71+
6072
Import::Teller.new(options.token, options.teller_account_id, options.ynab_account_id).import
6173
end
6274
end

0 commit comments

Comments
 (0)