diff options
author | EuAndreh <eu@euandre.org> | 2025-06-06 04:23:13 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-06-06 04:23:13 -0300 |
commit | 3cb8c61be96bd26dec868f23cba9de3e6c3fcfaf (patch) | |
tree | 078e27f5888092d8b9b007106d70ecc886d08ee6 | |
parent | etc/guix/home.scm: Add "ngircd" and "inspircd" package (diff) | |
download | dotfiles-3cb8c61be96bd26dec868f23cba9de3e6c3fcfaf.tar.gz dotfiles-3cb8c61be96bd26dec868f23cba9de3e6c3fcfaf.tar.xz |
Add pijul package and configuration
-rwxr-xr-x | bin/vcs | 46 | ||||
-rw-r--r-- | etc/guix/home.scm | 1 | ||||
-rw-r--r-- | etc/sh/rc | 2 |
3 files changed, 48 insertions, 1 deletions
@@ -4,6 +4,7 @@ set -eu TYPES=' git +pijul fossil bitkeeper darcs @@ -15,6 +16,8 @@ cvs guess_type() { if [ -e "$1"/.git ] || { [ -n "${GIT_DIR:-}" ] && [ -n "$GIT_WORK_TREE" ]; }; then echo git + elif [ -e "$1"/.pijul ]; then + echo pijul elif [ -e "$1"/.hg ]; then echo mercurial elif [ -e "$1"/.bk ]; then @@ -135,6 +138,45 @@ git_ps1() { color -c blacki " - git/$(git rev-parse HEAD)" } +pijul_ps1() { + LINE="$(pijul channel | awk '$1 == "*" && $0=$2')" + + DIFF_LINES="$(pijul diff -u -s)" + HAS_DIFF=false + HAS_UNTRACKED=false + if printf '%s\n' "$DIFF_LINES" | grep -q '^[A|D|M|R| ][M|D| ]'; then + HAS_DIFF=true + fi + if printf '%s\n' "$DIFF_LINES" | grep -Eq '^([?][?]| A)'; then + HAS_UNTRACKED=true + fi + + if [ "$HAS_DIFF" = true ]; then + COLOR_FN=redb + LINE="{$LINE}" + elif [ "$IS_AHEAD" = true ] || [ "$IS_BEHIND" = true ]; then + COLOR_FN=bluei + LINE="[$LINE]" + elif [ "$HAS_UNTRACKED" = true ]; then + COLOR_FN=lightblue + LINE="{$LINE}" + else + COLOR_FN=green + LINE="($LINE)" + fi + + color -c "$COLOR_FN" "$LINE" + + CHANNEL_COUNT="$(pijul channel | wc -l)" + if [ "$CHANNEL_COUNT" -gt 1 ]; then + color -c lightblue "<$CHANNEL_COUNT>" + fi + + CHANGEID="$(pijul log --limit 1 --output-format json | + jq -r '.[0].hash')" + color -c blacki " - pijul/$CHANGEID" +} + bitkeeper_ps1() { printf '' } @@ -178,6 +220,10 @@ git_ls() { git ls-files } +pijul_ls() { + pijul ls +} + fossil_ls() { fossil ls } diff --git a/etc/guix/home.scm b/etc/guix/home.scm index 5ca5875..e4a47a2 100644 --- a/etc/guix/home.scm +++ b/etc/guix/home.scm @@ -153,6 +153,7 @@ cvs subversion quilt + pijul ;; urubu gperftools @@ -210,7 +210,7 @@ alias diff='diff --color=auto' alias watch='watch --color ' alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man' alias less='less -R' -alias tree='tree -F -aC -I .git -I vendor -I STUFF -I refers' +alias tree='tree -F -aC -I .git -I .pijul -I vendor -I STUFF -I refers' alias make='make -e --no-print-directory' alias mv='mv -i' alias bc='bc -lq' |