Skip to content

Change the oneline option to a tebular version in the git summary#1031

Merged
spacewander merged 1 commit intotj:masterfrom
guenhter:tebelar-bulk-output
Feb 12, 2023
Merged

Change the oneline option to a tebular version in the git summary#1031
spacewander merged 1 commit intotj:masterfrom
guenhter:tebelar-bulk-output

Conversation

@guenhter
Copy link
Copy Markdown
Contributor

@guenhter guenhter commented Feb 2, 2023

Hi,

I've change the git summary --oneline to git summary --output-style tabular which gives an output like this:

# Repo                        | Age      | Last active  | Active on | Commits | Uncommitted
dev-infrastructure-automation | 8 weeks  | 18 hours ago | 22 days   | 46      | 0

When this is combined with the git bulk command, and some other bash magic, then this result can be achieved:

$ git bulk -q summary --output-style tabular | sed '1b;/^#/d' | column -t -s "|" -o "|" 
Core command "summary" accepted.
# Repo                            | Age                 | Last active          | Active on | Commits | Uncommitted
deno-data-handler-prototype       | 9 weeks             | 13 days ago          | 7 days    | 23      | 0
udp-handler                       | 9 weeks             | 2 weeks ago          | 2 days    | 5       | 0
azure-client                      | 9 weeks             | 2 weeks ago          | 2 days    | 4       | 0
dev-infrastructure-automation     | 8 weeks             | 18 hours ago         | 22 days   | 46      | 0
gitlab-project-settings-corrector | 4 months            | 2 weeks ago          | 2 days    | 3       | 0
free-for-all                      | 2 weeks             | 2 weeks ago          | 1 days    | 2       | 0
realm-initializer                 | 4 months            | 6 days ago           | 8 days    | 29      | 0
gitlab-k8s-cleaner                | 4 months            | 4 months ago         | 2 days    | 7       | 0
ci-docker-images                  | 4 months            | 7 days ago           | 4 days    | 9       | 0
...

The main advantage is, that the redundant header information stays just in the header and not pollutes the single lines any more.

@guenhter
Copy link
Copy Markdown
Contributor Author

guenhter commented Feb 2, 2023

Closes #1023

Comment thread Commands.md Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest keeping the oneline output as another output style.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Now both styles are supported

Comment thread bin/git-summary Outdated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When running this, I get:

column: invalid option -- 'o'
usage: column [-txne] [-c columns] [-s sep] [file ...]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, that is weired. What OS and do you use and what version of column do you have. According to https://man7.org/linux/man-pages/man1/column.1.html the -o option is there and on my ubuntu 22.04 it's also working.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

man column show that:

HISTORY
     The column command appeared in 4.3BSD-Reno.

There is not version output option in my column

Copy link
Copy Markdown
Contributor Author

@guenhter guenhter Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checked. The BSD column command just doesn't have the -o option. I have to think about this how to solve it because the -o would be quite important to have a separator between columns, else my overall-command can't distinguish the single columns...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got rid of the -o option.

@spacewander
Copy link
Copy Markdown
Collaborator

Let's merge master to make CI pass.

@guenhter
Copy link
Copy Markdown
Contributor Author

guenhter commented Feb 9, 2023

Done.

@spacewander spacewander merged commit a008308 into tj:master Feb 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants