Skip to content

Commit

Permalink
set readline to allow for backspace in ask dialog
Browse files Browse the repository at this point in the history
This makes it possible to use backspace to correct typos when entering accounts
  • Loading branch information
mrtazz committed Mar 6, 2015
1 parent 48df650 commit 978801f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/reckon/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ def walk_backwards
end

ledger = if row[:money] > 0
out_of_account = ask("Which account provided this income? ([account]/[q]uit/[s]kip) ") { |q| q.default = guess_account(row) }
out_of_account = ask("Which account provided this income? ([account]/[q]uit/[s]kip) ") { |q|
q.readline = true
q.default = guess_account(row)
}
finish if out_of_account == "quit" || out_of_account == "q"
if out_of_account == "skip" || out_of_account == "s"
puts "Skipping"
Expand All @@ -81,7 +84,10 @@ def walk_backwards
[options[:bank_account], row[:pretty_money]],
[out_of_account, row[:pretty_money_negated]] )
else
into_account = ask("To which account did this money go? ([account]/[q]uit/[s]kip) ") { |q| q.default = guess_account(row) }
into_account = ask("To which account did this money go? ([account]/[q]uit/[s]kip) ") { |q|
q.readline = true
q.default = guess_account(row)
}
finish if into_account == "quit" || into_account == 'q'
if into_account == "skip" || into_account == 's'
puts "Skipping"
Expand Down Expand Up @@ -261,6 +267,7 @@ def self.parse_opts(args = ARGV)

unless options[:bank_account]
options[:bank_account] = ask("What is the account name of this bank account in Ledger? ") do |q|
q.readline = true
q.validate = /^.{2,}$/
q.default = "Assets:Bank:Checking"
end
Expand Down

0 comments on commit 978801f

Please sign in to comment.