just: format

This commit is contained in:
Simon Michael 2023-12-09 00:29:21 -10:00
parent 74864f682e
commit b6531a516e

146
justfile
View File

@ -4,7 +4,6 @@
# https://just.systems/man/en/chapter_31.html Functions # https://just.systems/man/en/chapter_31.html Functions
# See also Makefile, Shake.hs # See also Makefile, Shake.hs
@help: @help:
just -lu just -lu
@ -24,50 +23,50 @@
# Symlink/copy important files temporarily in .relfiles/. # Symlink/copy important files temporarily in .relfiles/.
relfiles: relfiles:
#!/usr/bin/env bash #!/usr/bin/env bash
echo "linking/copying important release files in .relfiles/ for convenient access..." echo "linking/copying important release files in .relfiles/ for convenient access..."
mkdir -p .relfiles mkdir -p .relfiles
cd .relfiles cd .relfiles
for f in \ for f in \
../stack.yaml \ ../stack.yaml \
../Shake.hs \ ../Shake.hs \
../hledger-install/hledger-install.sh \ ../hledger-install/hledger-install.sh \
../CHANGES.md \ ../CHANGES.md \
../hledger/CHANGES.md \ ../hledger/CHANGES.md \
../hledger-ui/CHANGES.md \ ../hledger-ui/CHANGES.md \
../hledger-web/CHANGES.md \ ../hledger-web/CHANGES.md \
../hledger-lib/CHANGES.md \ ../hledger-lib/CHANGES.md \
../doc/github-release.md \ ../doc/github-release.md \
../doc/ANNOUNCE \ ../doc/ANNOUNCE \
../doc/ANNOUNCE.masto \ ../doc/ANNOUNCE.masto \
../site/src/release-notes.md \ ../site/src/release-notes.md \
../site/src/install.md \ ../site/src/install.md \
; do ln -sf $f .; done ; do ln -sf $f .; done
cp ../doc/RELEASING.md ./RELEASING2.md # temp copy which can be edited without disruption cp ../doc/RELEASING.md ./RELEASING2.md # temp copy which can be edited without disruption
# Prepare to release today, creating/switching to release branch, updating versions, manuals, changelogs etc. # Prepare to release today, creating/switching to release branch, updating versions, manuals, changelogs etc.
relprep VER: relprep VER:
#!/usr/bin/env bash #!/usr/bin/env bash
[[ -z {{VER}} ]] && usage [[ -z {{ VER }} ]] && usage
BRANCH=$(just _versionReleaseBranch {{VER}}) BRANCH=$(just _versionReleaseBranch {{ VER }})
COMMIT="-c" COMMIT="-c"
echo "Switching to $BRANCH, auto-creating it if needed..." echo "Switching to $BRANCH, auto-creating it if needed..."
_gitSwitchAutoCreate "$BRANCH" _gitSwitchAutoCreate "$BRANCH"
echo "Bumping all version strings to {{VER}} ..." echo "Bumping all version strings to {{ VER }} ..."
./Shake setversion {{VER}} $COMMIT ./Shake setversion {{ VER }} $COMMIT
echo "Updating all command help texts for embedding..." echo "Updating all command help texts for embedding..."
./Shake cmdhelp $COMMIT ./Shake cmdhelp $COMMIT
echo "Updating all dates in man pages..." echo "Updating all dates in man pages..."
./Shake mandates ./Shake mandates
echo "Generating all the manuals in all formats...." echo "Generating all the manuals in all formats...."
./Shake manuals $COMMIT ./Shake manuals $COMMIT
echo "Updating CHANGES.md files with latest commits..." echo "Updating CHANGES.md files with latest commits..."
./Shake changelogs $COMMIT ./Shake changelogs $COMMIT
# Push the current branch to github to generate release binaries. # Push the current branch to github to generate release binaries.
@relbin: @relbin:
# assumes the github remote is named "github" # assumes the github remote is named "github"
git push -f github HEAD:binaries git push -f github HEAD:binaries
# *** hledger version numbers # *** hledger version numbers
# See doc/RELEASING.md > Glossary. # See doc/RELEASING.md > Glossary.
@ -100,12 +99,12 @@ relprep VER:
_versionReleaseBranch VER: _versionReleaseBranch VER:
#!/usr/bin/env bash #!/usr/bin/env bash
MAJOR=$(just _versionMajorPart {{ VER }}) MAJOR=$(just _versionMajorPart {{ VER }})
if [[ $(just _versionIsDev {{VER}}) == y ]] then if [[ $(just _versionIsDev {{ VER }}) == y ]] then
echo "{{VER}} is not a releasable version" >&2 echo "{{ VER }} is not a releasable version" >&2
exit 1 exit 1
elif [[ $(just _versionIsPreview {{VER}}) == y ]] then elif [[ $(just _versionIsPreview {{ VER }}) == y ]] then
# echo "$(just majorVersionIncrement "$MAJOR")-branch" # echo "$(just majorVersionIncrement "$MAJOR")-branch"
echo "{{VER}} is not a releasable version" >&2 echo "{{ VER }} is not a releasable version" >&2
exit 1 exit 1
else else
echo "$MAJOR-branch" echo "$MAJOR-branch"
@ -115,43 +114,43 @@ _versionReleaseBranch VER:
# Does the named branch exist in this git repo ? # Does the named branch exist in this git repo ?
@_gitBranchExists BRANCH: @_gitBranchExists BRANCH:
git branch -l {{BRANCH}} | grep -q {{BRANCH}} git branch -l {{ BRANCH }} | grep -q {{ BRANCH }}
# Switch to the named git branch, creating it if it doesn't exist. # Switch to the named git branch, creating it if it doesn't exist.
_gitSwitchAutoCreate BRANCH: _gitSwitchAutoCreate BRANCH:
#!/usr/bin/env bash #!/usr/bin/env bash
if just _gitBranchExists {{BRANCH}}; then if just _gitBranchExists {{ BRANCH }}; then
git switch {{BRANCH}} git switch {{ BRANCH }}
else else
git switch -c {{BRANCH}} git switch -c {{ BRANCH }}
fi fi
# ** misc # ** misc
# Show last week's activity, for TWIH # Show last week's activity, for TWIH
@lastweek: @lastweek:
echo "hledger time last 7 days including today (this should be run on a Friday):" echo "hledger time last 7 days including today (this should be run on a Friday):"
tt bal hledger -DTS -b '6 days ago' --drop 2 tt bal hledger -DTS -b '6 days ago' --drop 2
echo echo
echo "By activity type, percentage:" echo "By activity type, percentage:"
tt bal hledger -DTS -b '6 days ago' --pivot t -% -c 1% | tail +1 tt bal hledger -DTS -b '6 days ago' --pivot t -% -c 1% | tail +1
echo echo
echo "Time log details:" echo "Time log details:"
tt print hledger -b '6 days ago' | grep -E '^[^ ]|hledger' tt print hledger -b '6 days ago' | grep -E '^[^ ]|hledger'
echo echo
echo "main repo:" echo "main repo:"
git log --format='%C(yellow)%cd %ad %Cred%h%Creset %s %Cgreen(%an)%Creset%C(bold blue)%d%Creset' --date=short --since="6 days ago" --reverse git log --format='%C(yellow)%cd %ad %Cred%h%Creset %s %Cgreen(%an)%Creset%C(bold blue)%d%Creset' --date=short --since="6 days ago" --reverse
echo echo
echo "site repo:" echo "site repo:"
git -C site log --format='%C(yellow)%cd %ad %Cred%h%Creset %s %Cgreen(%an)%Creset%C(bold blue)%d%Creset' --date=short --since="6 days ago" --reverse git -C site log --format='%C(yellow)%cd %ad %Cred%h%Creset %s %Cgreen(%an)%Creset%C(bold blue)%d%Creset' --date=short --since="6 days ago" --reverse
echo echo
echo "finance repo:" echo "finance repo:"
git -C finance log --format='%C(yellow)%cd %ad %Cred%h%Creset %s %Cgreen(%an)%Creset%C(bold blue)%d%Creset' --date=short --since="6 days ago" --reverse git -C finance log --format='%C(yellow)%cd %ad %Cred%h%Creset %s %Cgreen(%an)%Creset%C(bold blue)%d%Creset' --date=short --since="6 days ago" --reverse
echo echo
# Show a bunch of debug messages. # Show a bunch of debug messages.
@_dbgmsgs: @_dbgmsgs:
rg --sort path -t hs 'dbg.*?(".*")' -r '$1' -o rg --sort path -t hs 'dbg.*?(".*")' -r '$1' -o
# # Extract Hledger.hs examples to jargon.j. # # Extract Hledger.hs examples to jargon.j.
# @_jargon: # @_jargon:
@ -159,9 +158,8 @@ _gitSwitchAutoCreate BRANCH:
# echo "wrote jargon.j" # echo "wrote jargon.j"
# Extract ledger/hledger/beancount commit stats to project-commits.j. # Extract ledger/hledger/beancount commit stats to project-commits.j.
# See also https://hledger.org/reporting-version-control-stats.html
@_projectcommits: @_projectcommits:
printf "account ledger\naccount hledger\naccount beancount\n\n" >project-commits.j # https://hledger.org/reporting-version-control-stats.html
for p in ledger hledger beancount; do git -C ../$p log --format="%cd (%h) %s%n ($p) 1%n" --date=short --reverse >> project-commits.j; done printf "account ledger\naccount hledger\naccount beancount\n\n" >project-commits.j
echo "wrote project-commits.j" for p in ledger hledger beancount; do git -C ../$p log --format="%cd (%h) %s%n ($p) 1%n" --date=short --reverse >> project-commits.j; done
echo "wrote project-commits.j"