;tools: just log -> twih, cleanups

This commit is contained in:
Simon Michael 2024-05-06 17:39:23 -10:00
parent 4af919e377
commit be1d98ef75

View File

@ -912,35 +912,40 @@ NEWS:
@_tomorroworlastfriday *DATE: @_tomorroworlastfriday *DATE:
echo {{ if DATE == '' { `$GDATE -I -d 'last friday'` } else { `$GDATE -I -d tomorrow` } }} echo {{ if DATE == '' { `$GDATE -I -d 'last friday'` } else { `$GDATE -I -d tomorrow` } }}
# Show activity between the last two fridays (suitable for TWIH), or since this date # Show a draft This Week In Hledger post, with activity between the last two fridays (by default)
log *DATE: twih: # *DATE:
#!/usr/bin/env osh #!/usr/bin/env osh
printf "Last release: `just rel`\n\n"
BEG=`just _dateortwofridaysago $DATE` BEG=`just _dateortwofridaysago $DATE`
END=`just _todayorlastfriday $DATE` END=`just _todayorlastfriday $DATE`
just timelog $DATE cat <<END
if [[ $DATE == '' ]]; then printf "<https://hledger.org/news.html#this-week-in-hledger-$END>\n\n"; fi ## This Week In Hledger $END
just worklog $DATE
**sm**
END
printf "DRAFT:\n\n"
just commitlog $DATE just commitlog $DATE
# just chatlog $DATE printf "last release: `just rel`\n\n"
# just maillog $DATE just worklog $DATE
# just redditlog $DATE just timelog $DATE
# just tootlog $DATE cat <<END
# just bloglog
**Misc**
- for recent discussions, see <https://hledger.org/support.html>.
**Quotes**
**
**
<https://hledger.org/news.html#this-week-in-hledger-$END>
---
END
# Show hledger-related time logged between the last two fridays or since this date GITSHORTFMT := "--format='%ad %s' --date=short"
timelog *DATE:
#!/usr/bin/env osh
BEG=`just _dateortwofridaysago $DATE`
END=`just _todayorlastfriday $DATE`
END1=`just _tomorroworlastfriday $DATE`
printf "** Time log in $BEG..$END\n\n"
hledger -f $TIMELOG print hledger -b $BEG -e $END1 | rg '^2|hledger'
echo
hledger -f $TIMELOG bal -S hledger -b $BEG -e $END1
echo
GITSHORTFMT := "--format='%ad %h %s' --date=short"
# Show commits briefly in the three hledger repos between the last two fridays or since this date # Show commits briefly in the three hledger repos between the last two fridays or since this date
commitlog *DATE: commitlog *DATE:
@ -948,14 +953,14 @@ commitlog *DATE:
BEG=`just _dateortwofridaysago $DATE` BEG=`just _dateortwofridaysago $DATE`
END=`just _todayorlastfriday $DATE` END=`just _todayorlastfriday $DATE`
printf "** commits in $BEG..$END\n" printf "** commits in $BEG..$END\n"
printf "** hledger commits\n" printf "** hledger\n"
git log {{ GITSHORTFMT }} --since $BEG --until $END --reverse git log {{ GITSHORTFMT }} --since $BEG --until $END --reverse | sed -E -e 's/ ;/ /'
printf "** site commits\n" printf "** site\n"
git -C site log {{ GITSHORTFMT }} --since $BEG --until $END --reverse git -C site log {{ GITSHORTFMT }} --since $BEG --until $END --reverse | sed -E -e 's/ ;/ /'
printf "** finance commits\n" printf "** finance\n"
git -C finance log {{ GITSHORTFMT }} --since $BEG --until $END --reverse git -C finance log {{ GITSHORTFMT }} --since $BEG --until $END --reverse | sed -E -e 's/ ;/ /'
printf "** plaintextaccounting.org commits\n" printf "** plaintextaccounting.org\n"
git -C ../plaintextaccounting.org log {{ GITSHORTFMT }} --since $BEG --until $END --reverse git -C ../plaintextaccounting.org log {{ GITSHORTFMT }} --since $BEG --until $END --reverse | sed -E -e 's/ ;/ /'
echo echo
WORKLOG := "../../notes/CLOUD/hledger log.md" WORKLOG := "../../notes/CLOUD/hledger log.md"
@ -978,6 +983,18 @@ worklog *DATE:
# awk "/^#### $BEGLOGGED/{p=1;print;next}; /#### $ENDLOGGED/{p=0}; /^## /{p=0}; p" "$WORKLOG" # awk "/^#### $BEGLOGGED/{p=1;print;next}; /#### $ENDLOGGED/{p=0}; /^## /{p=0}; p" "$WORKLOG"
echo echo
# Show hledger-related time logged between the last two fridays or since this date
timelog *DATE:
#!/usr/bin/env osh
BEG=`just _dateortwofridaysago $DATE`
END=`just _todayorlastfriday $DATE`
END1=`just _tomorroworlastfriday $DATE`
printf "** Time log in $BEG..$END\n\n"
hledger -f $TIMELOG print hledger -b $BEG -e $END1 | rg '^2|hledger'
echo
hledger -f $TIMELOG bal -S --format '%-20(account) %12(total)' hledger -b $BEG -e $END1
echo
# Copy some text to the system clipboard if possible # Copy some text to the system clipboard if possible
@_clip TEXT: @_clip TEXT:
type -P pbcopy >/dev/null && (printf "$TEXT" | pbcopy) type -P pbcopy >/dev/null && (printf "$TEXT" | pbcopy)