just: format

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

View File

@ -4,7 +4,6 @@
# https://just.systems/man/en/chapter_31.html Functions
# See also Makefile, Shake.hs
@help:
just -lu
@ -48,13 +47,13 @@ relfiles:
# Prepare to release today, creating/switching to release branch, updating versions, manuals, changelogs etc.
relprep VER:
#!/usr/bin/env bash
[[ -z {{VER}} ]] && usage
BRANCH=$(just _versionReleaseBranch {{VER}})
[[ -z {{ VER }} ]] && usage
BRANCH=$(just _versionReleaseBranch {{ VER }})
COMMIT="-c"
echo "Switching to $BRANCH, auto-creating it if needed..."
_gitSwitchAutoCreate "$BRANCH"
echo "Bumping all version strings to {{VER}} ..."
./Shake setversion {{VER}} $COMMIT
echo "Bumping all version strings to {{ VER }} ..."
./Shake setversion {{ VER }} $COMMIT
echo "Updating all command help texts for embedding..."
./Shake cmdhelp $COMMIT
echo "Updating all dates in man pages..."
@ -100,12 +99,12 @@ relprep VER:
_versionReleaseBranch VER:
#!/usr/bin/env bash
MAJOR=$(just _versionMajorPart {{ VER }})
if [[ $(just _versionIsDev {{VER}}) == y ]] then
echo "{{VER}} is not a releasable version" >&2
if [[ $(just _versionIsDev {{ VER }}) == y ]] then
echo "{{ VER }} is not a releasable version" >&2
exit 1
elif [[ $(just _versionIsPreview {{VER}}) == y ]] then
elif [[ $(just _versionIsPreview {{ VER }}) == y ]] then
# echo "$(just majorVersionIncrement "$MAJOR")-branch"
echo "{{VER}} is not a releasable version" >&2
echo "{{ VER }} is not a releasable version" >&2
exit 1
else
echo "$MAJOR-branch"
@ -115,15 +114,15 @@ _versionReleaseBranch VER:
# Does the named branch exist in this git repo ?
@_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.
_gitSwitchAutoCreate BRANCH:
#!/usr/bin/env bash
if just _gitBranchExists {{BRANCH}}; then
git switch {{BRANCH}}
if just _gitBranchExists {{ BRANCH }}; then
git switch {{ BRANCH }}
else
git switch -c {{BRANCH}}
git switch -c {{ BRANCH }}
fi
# ** misc
@ -159,9 +158,8 @@ _gitSwitchAutoCreate BRANCH:
# echo "wrote jargon.j"
# Extract ledger/hledger/beancount commit stats to project-commits.j.
# See also https://hledger.org/reporting-version-control-stats.html
@_projectcommits:
# https://hledger.org/reporting-version-control-stats.html
printf "account ledger\naccount hledger\naccount beancount\n\n" >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"