From dea03f856ae19a2ba0cfbd3db88129101a800432 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Mon, 17 May 2021 08:09:08 -0400 Subject: suggest accounts by putting them first in list, and other changes --- hledger-fadd | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/hledger-fadd b/hledger-fadd index fa3d8e7..3e9b9be 100755 --- a/hledger-fadd +++ b/hledger-fadd @@ -20,18 +20,18 @@ payee=$(hledger payees | fz --prompt="payee: ") echo "payee: $payee" # TODO: handle more than just 2 accounts -to_account=$(hledger accounts | fz --prompt="to account: ") +to_account=$(cat <(hledger accounts payee:"$payee") <(hledger accounts) | fz --prompt="to account: ") echo "to account: $to_account" read -rep "to amount: " to_amount -from_account=$(hledger accounts | fz --prompt="from account: ") +from_account=$(cat <(hledger accounts payee:"$payee") <(hledger accounts) | fz --prompt="from account: ") echo "from account: $from_account" -read -rep "from amount: " from_amount +read -rep "from amount: " -i "-$to_amount" from_amount read -r -d '' TX <> "$tmp" cat "$tmp" -read -rep "all good? y/e/n " ok +read -rep "all good? Y/e/n " ok case $ok in - y) - cat "$tmp" >> ~/org/fund/ledger.journal + n) + exit 1 ;; e) vim "$tmp" && cat "$tmp" >> ~/org/fund/ledger.journal ;; *) - exit 1 + cat "$tmp" >> ~/org/fund/ledger.journal ;; esac -- cgit v1.2.3