From a841845d9a1465cc6d9b65b53baa2c71b8da1eeb Mon Sep 17 00:00:00 2001 From: Pierre Ayoub Date: Thu, 27 Feb 2025 07:25:55 +0100 Subject: [PATCH] Feat: allow git-summary showing full path of repository (#1193) * feat(git-summary): add --full-path option * docs(git-summary): add doc for --full-path option * docs(man): make using ronn * docs(git-extras-completion.zsh): add --full-path option of git-summary --- bin/git-summary | 11 ++++++++++- etc/git-extras-completion.zsh | 1 + man/git-summary.1 | 6 +++++- man/git-summary.html | 6 +++++- man/git-summary.md | 4 ++++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/bin/git-summary b/bin/git-summary index f90adf1..b69a9ae 100755 --- a/bin/git-summary +++ b/bin/git-summary @@ -3,12 +3,16 @@ cd "$(git root)" || { echo "Can't cd to top level directory";exit 1; } +PROJECT_FULL_PATH= SUMMARY_BY_LINE= DEDUP_BY_EMAIL= MERGES_ARG= OUTPUT_STYLE= for arg in "$@"; do case "$arg" in + --full-path) + PROJECT_FULL_PATH=1 + ;; --line) SUMMARY_BY_LINE=1 ;; @@ -51,7 +55,12 @@ if [ -n "$SUMMARY_BY_LINE" ]; then else [ $# -ne 0 ] && commit=$* fi -project=${PWD##*/} + +if [[ -n "$PROJECT_FULL_PATH" ]]; then + project=${PWD/${HOME}/\~} +else + project=${PWD##*/} +fi # # get date for the given diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 9e1c18d..63e77f5 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -370,6 +370,7 @@ _git-standup() { } _git-summary() { + _arguments '--full-path[show repository full path]' _arguments '--line[summarize with lines rather than commits]' _arguments '--dedup-by-email[remove duplicate users by the email address]' _arguments '--no-merges[exclude merge commits]' diff --git a/man/git-summary.1 b/man/git-summary.1 index 87a3085..a5594be 100644 --- a/man/git-summary.1 +++ b/man/git-summary.1 @@ -1,6 +1,6 @@ .\" generated with Ronn-NG/v0.9.1 .\" http://github.com/apjanke/ronn-ng/tree/0.9.1 -.TH "GIT\-SUMMARY" "1" "June 2023" "" "Git Extras" +.TH "GIT\-SUMMARY" "1" "February 2025" "" "Git Extras" .SH "NAME" \fBgit\-summary\fR \- Show repository summary .SH "SYNOPSIS" @@ -38,6 +38,10 @@ $ git summary \-\-dedup\-by\-email .P Exclude merge commits\. .P +\-\-full\-path +.P +Show the full path of the repository instead of its directory name\. +.P \-\-line .P Summarize with lines other than commits\. When \fB\-\-line\fR is specified, the last argument is treated as \. diff --git a/man/git-summary.html b/man/git-summary.html index ffcd497..8122b82 100644 --- a/man/git-summary.html +++ b/man/git-summary.html @@ -114,6 +114,10 @@ $ git summary --dedup-by-email

Exclude merge commits.

+

--full-path

+ +

Show the full path of the repository instead of its directory name.

+

--line

Summarize with lines other than commits. @@ -221,7 +225,7 @@ git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / com

  1. -
  2. June 2023
  3. +
  4. February 2025
  5. git-summary(1)
diff --git a/man/git-summary.md b/man/git-summary.md index 11ca4bb..708586d 100644 --- a/man/git-summary.md +++ b/man/git-summary.md @@ -39,6 +39,10 @@ Shows a summary of the repository or a path within it. Exclude merge commits. + --full-path + + Show the full path of the repository instead of its directory name. + --line Summarize with lines other than commits.