From 183dbd37be9ebbaea201a29083ffdc61c859f56e Mon Sep 17 00:00:00 2001 From: Andrew Cady Date: Wed, 6 Oct 2021 18:15:05 -0400 Subject: git-ll-remote: improve output greatly --- dot/local/bin/git-ll-remote | 57 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 22 deletions(-) diff --git a/dot/local/bin/git-ll-remote b/dot/local/bin/git-ll-remote index 000e41d..a39ec3f 100755 --- a/dot/local/bin/git-ll-remote +++ b/dot/local/bin/git-ll-remote @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash while [ $# -gt 0 ] do @@ -20,12 +20,15 @@ done remote=${1:-origin} -SHOW=ahead -[ "$OPT_a" ] && SHOW=all -[ "$OPT_r" ] && SHOW=behind +QUIET=y +SHOW=all +[ "$OPT_a" ] && SHOW=ahead +[ "$OPT_A" ] && SHOW=all +[ "$OPT_b" ] && SHOW=behind [ "$OPT_u" ] && SHOW=upto -QUIET= +[ "$OPT_d" ] && SHOW=diverged [ "$OPT_q" ] && QUIET=y +[ "$OPT_v" ] && QUIET= [ "$OPT_n" ] && NS_ONLY=y [ "$OPT_N" ] && NS_ONLY= @@ -36,16 +39,27 @@ show_message() show_all_message() { + return cat >&2 <&2 <&2 <&2 printf 'remote: %s (%s)\n' "$ref" "$VERDICT" - else - >&2 printf 'remote: %s\n' "$ref" + # The length of the subject is allowed to be one longer only if it's truncated. + # The visual protrusion makes truncation unambiguous even in case literal "..." included in subject field. + subj=${subj%??}... fi - git show "$hash" | sed '/^$/q' + printf "%-42s %17s %-${author_size}s %-$((subj_size + 1))s %10s %s\n" "$hash" "$when" "$author" "$subj" "($VERDICT)" "$ref" listed=$((listed + 1)) else skipped=$((skipped + 1)) -- cgit v1.2.3