#!/bin/bash # * pijul command line aliases # These aliases and usage notes help me be productive with pijul. # They are tested with bash. If you'd like to try them: # # $ pijul clone https://nest.pijul.com/simonmichael/pijul-scripts # $ . pijul-scripts/bashrc THISFILE=~/src/pijul-scripts/bashrc PIJULCONFDIR=~/Library/Application\ Support/pijul # mac # pjh - show help for these aliases pjh() { grep -E '^# (pj|\*)' "$THISFILE" | sed -e 's/^# \*\*/\n**/' -e 's/^# //' ; } # pjhh - show more verbose help with equivalent commands pjhh() { grep -E '^# (pj|\*| \S)' "$THISFILE" | sed -e 's/^# \*\*/\n**/' -e 's/^# //' ; } # pj [CMD] - run a pijul command or show pijul's help alias pj=pijul # ** Setup/uninstall helpers # pjkeygen - generate a change-signing key for current user # pijul key generate `whoami` alias pjkeygen='pj key generate `whoami`' # pjconfrm - erase current user's pijul config and keys # rm -ri $PIJULCONFDIR # shellcheck disable=SC2139 alias pjconfrm="echo 'warning: this will erase your pijul config and keys'; rm -ri \"$PIJULCONFDIR\"" # # pjreporm - immediately erase pijul config and history in the current directory # alias pjreporm='rm -rf .pijul' # ** List recorded changes in current repo # pjl - standard list # pijul log (like git log, darcs log) alias pjl='pj log' # pjlv - list with full descriptions. (?) # pijul log --description alias pjlv='pj log --description' # pjls - list with summary of file changes # (like git log --stat, darcs log -s) pjls() { for H in $(pjlh); do echo "$H"; pjshowstat "$H"; echo; done; } # pjhashes [N] - list the change hashes, or just the last N hashes # pijul log --hash-only pjhashes() { N="$1" if [[ -n $N ]]; then pj log --hash-only | head -n "$N" else pj log --hash-only fi } # ** Inspect a recorded change # pjshow [HASH] - show the last or specified change in full # pijul change (like git show [HASH], darcs log -v -h HASH) alias pjshow='pj change' # pjshowstat [HASH] - summarise the last or specified change # (like git show --stat [HASH], darcs log -s -h HASH) # shellcheck disable=SC2086 pjshowstat() { pj change $1 | grep -E '^(message =|[0-9])'; } # ** Show unrecorded changes # pjs - summarise unrecorded changes (except added files), -u for untracked files # pijul diff -s (like git status -s, darcs whatsnew -s) alias pjs='pj diff -s' # pjd - show unrecorded changes in full (except added files) # pijul diff (like git diff, darcs whatsnew) alias pjd='pj diff' # ** Record changes # pjrec 'MSG' [PATHS] - record all unrecorded changes, with the given message # pijul record -am 'MSG' (like git commit -am 'MSG', darcs record -am 'MSG') alias pjrec='pj record -a -m' # pjamend [HASH] [PATHS] - add all unrecorded changes to last or specified patch # pijul record -a --amend [HASH] (like git commit --amend -a, darcs amend -a) alias pjamend='pj record -a --amend'