mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 09:36:14 +01:00
51 lines
1.1 KiB
Bash
51 lines
1.1 KiB
Bash
# -*- mode: shell-script -*-
|
|
|
|
iargs=("$@")
|
|
oargs=()
|
|
j=0;
|
|
date=;
|
|
for((i=0; i<${#iargs[@]}; ++i)); do
|
|
case ${iargs[i]} in
|
|
--date-format)
|
|
# drop --date-format and the next arg
|
|
i=$((i+1));
|
|
;;
|
|
--sort)
|
|
# drop --sort and the next arg
|
|
i=$((i+1));
|
|
;;
|
|
--limit)
|
|
# drop --limit and the next arg
|
|
i=$((i+1));
|
|
;;
|
|
--collapse)
|
|
# drop --collapse and the next arg
|
|
i=$((i+1));
|
|
;;
|
|
--uncleared)
|
|
oargs[j]="-UP";
|
|
j=$((j+1))
|
|
;;
|
|
xact)
|
|
# convert "xact" to "print --match"
|
|
oargs[j]=print; oargs[j+1]=--match; j=$((j+2));
|
|
# drop xact argument and stash the date argument
|
|
i=$((i+1));
|
|
date=${iargs[i]};
|
|
;;
|
|
*)
|
|
# keep any other args:
|
|
oargs[j]=${iargs[i]};
|
|
j=$((j+1));
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if test "$date"
|
|
then
|
|
# substitute the given date for the old date:
|
|
hledger "${oargs[@]}" | sed "1s/....-..-../$date/"
|
|
else
|
|
hledger "${oargs[@]}"
|
|
fi
|