Add clear function for t to null out balance for item

main
Ensar Sarajčić 2024-05-07 15:35:41 +02:00
parent 6170e78e97
commit a52c07bb9d
2 changed files with 14 additions and 0 deletions

View File

@ -25,6 +25,7 @@ usage () {
echo " toggle - toggle current timer" echo " toggle - toggle current timer"
echo " bal - outputs current timesheet" echo " bal - outputs current timesheet"
echo " invoice - generate an invoice from account balance" echo " invoice - generate an invoice from account balance"
echo " clear - clear time for account and comment"
echo " invoice_list - generate data for an invoice from account balance" echo " invoice_list - generate data for an invoice from account balance"
echo " waybar - generate output for waybar module" echo " waybar - generate output for waybar module"
echo "" echo ""
@ -219,6 +220,12 @@ time_invoice () {
echo "Please review it and use pdflatex to generate it!" echo "Please review it and use pdflatex to generate it!"
} }
time_clear () {
echo "" >> "$TIMESHEET_LEDGER_HOME/invoices/$(date +%Y).journal"
echo "$(date '+%Y-%m-%d') * $COMMENT" >> "$TIMESHEET_LEDGER_HOME/invoices/$(date +%Y).journal"
echo " ($PROJECT) -$(ledger -f "$TIMESHEET_LEDGER_HOME/main.journal" bal $PROJECT and @"$COMMENT" --format "%(total)")" >> "$TIMESHEET_LEDGER_HOME/invoices/$(date +%Y).journal"
}
time_invoice_list () { time_invoice_list () {
if [ -z "$PROJECT" ]; then if [ -z "$PROJECT" ]; then
echo "Project is required!" echo "Project is required!"
@ -257,6 +264,9 @@ case $COMMAND in
invoice) invoice)
time_invoice time_invoice
;; ;;
clear)
time_clear
;;
invoice_list) invoice_list)
time_invoice_list time_invoice_list
;; ;;

View File

@ -39,5 +39,9 @@ complete -c t -x -n "__fish_seen_subcommand_from bal" -a '(__fish-timesheets-ava
complete -c t -x -n "__fish_seen_subcommand_from invoice" -n "__fish_timesheets_arg_number 2" -a '(__fish-timesheets-available-projects)' complete -c t -x -n "__fish_seen_subcommand_from invoice" -n "__fish_timesheets_arg_number 2" -a '(__fish-timesheets-available-projects)'
complete -c t -x -n "__fish_seen_subcommand_from invoice" -n "__fish_timesheets_arg_number 3" -a '(__fish-timesheets-existing-comments)' complete -c t -x -n "__fish_seen_subcommand_from invoice" -n "__fish_timesheets_arg_number 3" -a '(__fish-timesheets-existing-comments)'
# clear
complete -c t -x -n "__fish_seen_subcommand_from clear" -n "__fish_timesheets_arg_number 2" -a '(__fish-timesheets-available-projects)'
complete -c t -x -n "__fish_seen_subcommand_from clear" -n "__fish_timesheets_arg_number 3" -a '(__fish-timesheets-existing-comments)'
# Invoice list # Invoice list
complete -c t -x -n "__fish_seen_subcommand_from invoice_list" -a '(__fish-timesheets-available-projects)' complete -c t -x -n "__fish_seen_subcommand_from invoice_list" -a '(__fish-timesheets-available-projects)'