Add the current branch git summary (#1034)

Co-authored-by: guenthgr <guenther.grill@frauscher.com>
This commit is contained in:
Günther Grill 2023-02-27 04:26:53 +01:00 committed by GitHub
parent b372bab52a
commit d5eaa1895b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 21 deletions

View file

@ -153,6 +153,7 @@ $ git summary
project : git-extras
repo age : 10 months ago
branch : master
last active : 3 weeks ago
active on : 93 days
commits : 163
@ -226,11 +227,11 @@ This is how the `tebular` output style and `oneline` output style look like
```bash
$ git summary --output-style tabular
# Repo | Age | Last active | Active on | Commits | Uncommitted
git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3
# Repo | Age | Last active | Active on | Commits | Uncommitted | Branch
git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3 | master
$ git summary --output-style oneline
git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3
git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3 / branch: master
```
## git effort

View file

@ -172,6 +172,10 @@ single_file() {
done
}
current_branch_name() {
git rev-parse --abbrev-ref HEAD
}
#
# list the author for all file
#
@ -211,14 +215,15 @@ print_summary_by_line() {
print_summary() {
if [ "$OUTPUT_STYLE" == "tabular" ]; then
tabular_headers="# Repo $SP Age $SP Last active $SP Active on $SP Commits $SP Uncommitted"
echo -e "$tabular_headers\n$project $SP $(repository_age) $SP $(last_active) $SP $(active_days "$commit") days $SP $(commit_count "$commit") $SP $(uncommitted_changes_count)" | column -t -s "$COLUMN_CMD_DELIMTER"
tabular_headers="# Repo $SP Age $SP Last active $SP Active on $SP Commits $SP Uncommitted $SP Branch"
echo -e "$tabular_headers\n$project $SP $(repository_age) $SP $(last_active) $SP $(active_days $commit) days $SP $(commit_count $commit) $SP $(uncommitted_changes_count) $SP $(current_branch_name)" | column -t -s "$COLUMN_CMD_DELIMTER"
elif [ "$OUTPUT_STYLE" == "oneline" ]; then
echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days "$commit") days / commits: $(commit_count "$commit") / uncommitted: $(uncommitted_changes_count)"
echo "$project / age: $(repository_age) / last active: $(last_active) / active on $(active_days $commit) days / commits: $(commit_count $commit) / uncommitted: $(uncommitted_changes_count) / branch: $(current_branch_name)"
else
echo
echo " project : $project"
echo " repo age : $(repository_age)"
echo " branch: : $(current_branch_name)"
echo " last active : $(last_active)"
# shellcheck disable=SC2086
echo " active on : $(active_days $commit) days"

View file

@ -69,7 +69,7 @@ This option can not be used together with \fB\-\-dedup\-by\-email\fR or \fB\-\-n
\-\-output\-style <style>
.
.P
Summarizes the repository and print the output accoring to the specified style\. Styles: * \fBtabular\fR: Prints the summary in a tabular form having a header in the first line and the values in the second * \fBoneline\fR: Prints the summary in a single line
Summarizes the repository and print the output accoring to the specified style\. Styles: * \fBtabular\fR: Prints the summary in a tabular form having a header in the first line and the values in the second\. Column separator is a \fB|\fR sorrounded by at least one space on each side\. * \fBoneline\fR: Prints the summary in a single line\. Fields are separated by a \fB/\fR sorrounded by one space on each side\.
.
.P
Some information like the authors cannot be displayed in this mode\.
@ -85,6 +85,7 @@ $ git summary
project : express
repo age : 10 months ago
branch : master
last active : 3 weeks ago
active on : 93 days
commits : 1893
@ -171,8 +172,8 @@ Tabular summary
.nf
$ git summary \-\-output\-style tabular
# Repo | Age | Last active | Active on | Commits | Uncommitted
git\-extras | 13 years | 7 hours ago | 807 days | 1703 | 3
# Repo | Age | Last active | Active on | Commits | Uncommitted | Branch
git\-extras | 13 years | 7 hours ago | 807 days | 1703 | 3 | master
.
.fi
.
@ -186,7 +187,7 @@ Oneline summary
.nf
$ git summary \-\-output\-style oneline
git\-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3
git\-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3 / branch: master
.
.fi
.

View file

@ -124,8 +124,10 @@ $ git summary --dedup-by-email
<p> Summarizes the repository and print the output accoring to the specified style.
Styles:
* <code>tabular</code>: Prints the summary in a tabular form having a header in the
first line and the values in the second
* <code>oneline</code>: Prints the summary in a single line</p>
first line and the values in the second. Column separator is a <code>|</code>
sorrounded by at least one space on each side.
* <code>oneline</code>: Prints the summary in a single line. Fields are separated by a <code>/</code>
sorrounded by one space on each side.</p>
<p> Some information like the authors cannot be displayed in this mode.</p>
@ -137,6 +139,7 @@ $ git summary --dedup-by-email
project : express
repo age : 10 months ago
branch : master
last active : 3 weeks ago
active on : 93 days
commits : 1893
@ -192,19 +195,19 @@ authors :
<p> Tabular summary</p>
<pre><code>$ git summary --output-style tabular
# Repo | Age | Last active | Active on | Commits | Uncommitted
git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3
# Repo | Age | Last active | Active on | Commits | Uncommitted | Branch
git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3 | master
</code></pre>
<p> Oneline summary</p>
<pre><code>$ git summary --output-style oneline
git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3
git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3 / branch: master
</code></pre>
<h2 id="AUTHOR">AUTHOR</h2>
<p>Written by Tj Holowaychuk &lt;<a href="&#109;&#97;&#105;&#x6c;&#116;&#x6f;&#x3a;&#116;&#x6a;&#64;&#x76;&#x69;&#x73;&#105;&#111;&#110;&#x2d;&#109;&#x65;&#x64;&#105;&#x61;&#46;&#99;&#97;" data-bare-link="true">&#x74;&#106;&#64;&#x76;&#x69;&#115;&#x69;&#x6f;&#110;&#45;&#x6d;&#x65;&#x64;&#x69;&#97;&#x2e;&#99;&#x61;</a>&gt;</p>
<p>Written by Tj Holowaychuk &lt;<a href="&#x6d;&#x61;&#105;&#108;&#x74;&#x6f;&#x3a;&#x74;&#106;&#x40;&#118;&#105;&#x73;&#105;&#x6f;&#x6e;&#x2d;&#x6d;&#101;&#100;&#x69;&#97;&#x2e;&#x63;&#97;" data-bare-link="true">&#116;&#106;&#x40;&#118;&#x69;&#115;&#x69;&#111;&#110;&#45;&#x6d;&#x65;&#x64;&#x69;&#x61;&#46;&#x63;&#97;</a>&gt;</p>
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>

View file

@ -50,8 +50,10 @@ Shows a summary of the repository or a path within it.
Summarizes the repository and print the output accoring to the specified style.
Styles:
* `tabular`: Prints the summary in a tabular form having a header in the
first line and the values in the second
* `oneline`: Prints the summary in a single line
first line and the values in the second. Column separator is a `|`
sorrounded by at least one space on each side.
* `oneline`: Prints the summary in a single line. Fields are separated by a `/`
sorrounded by one space on each side.
Some information like the authors cannot be displayed in this mode.
@ -63,6 +65,7 @@ Shows a summary of the repository or a path within it.
project : express
repo age : 10 months ago
branch : master
last active : 3 weeks ago
active on : 93 days
commits : 1893
@ -114,13 +117,13 @@ Shows a summary of the repository or a path within it.
Tabular summary
$ git summary --output-style tabular
# Repo | Age | Last active | Active on | Commits | Uncommitted
git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3
# Repo | Age | Last active | Active on | Commits | Uncommitted | Branch
git-extras | 13 years | 7 hours ago | 807 days | 1703 | 3 | master
Oneline summary
$ git summary --output-style oneline
git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3
git-extras / age: 13 years / last active: 7 hours ago / active on 807 days / commits: 1703 / uncommitted: 3 / branch: master
## AUTHOR