git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] pretty: add format specifiers: %gr, %gt, %gI, gi

From
Duy Nguyen <pclouds@gmail.com>
Date
Jul 10, 2016, 16:05 UTC
Message-ID
<CACsJy8CSqjTztFu1fOXqyS1jXjt=D_pgAC4MXpnECAcu+dRu2w@mail.gmail.com>
In-Reply-To
<20160710142622.GE26097@thunk.org>
On Sun, Jul 10, 2016 at 4:26 PM, Theodore Ts'o <tytso@mit.edu> wrote:
Show 5 quoted lines
> One other long-term thought.  Maybe past a certain point, we should
> just make it easy to get the data from git-log into a perl or pythons
> script, where it becomes possible to do conditionals, more flexible
> padding rules, etc.  So some kind of --format=yaml or --format=json
> sort of thing.
I thought libgit2 would already give you all the information you need.
Show 40 quoted lines
> Some interesting ideas of how we could do this can be
> found here:
>
>         https://cloud.google.com/sdk/gcloud/reference/topic/formats
>
> ... although I doubt whether git would ever want to do the equivalent of:
>
> gcloud compute images list  --format='table[box,title=Images](name:sort=1,family)'
>
> which will print something like this:
>
> +------------------------------------------------------------+
> |                           Images                           |
> +------------------------------------------+-----------------+
> |                   NAME                   |      FAMILY     |
> +------------------------------------------+-----------------+
> | centos-6-v20160629                       | centos-6        |
> | centos-7-v20160629                       | centos-7        |
> | coreos-alpha-1097-0-0-v20160702          | coreos-alpha    |
> | coreos-beta-1068-3-0-v20160627           | coreos-beta     |
> | coreos-stable-1010-6-0-v20160628         | coreos-stable   |
> | debian-8-jessie-v20160629                | debian-8        |
> | freebsd-101-release-amd64-20150101032704 |                 |
> | opensuse-13-2-v20160222                  |                 |
> | opensuse-leap-42-1-v20160302             |                 |
> | rhel-6-v20160629                         | rhel-6          |
> | rhel-7-v20160629                         | rhel-7          |
> | sles-11-sp4-v20160301                    |                 |
> | sles-12-sp1-v20160301                    |                 |
> | ubuntu-1204-precise-v20160627            | ubuntu-1204-lts |
> | ubuntu-1404-trusty-v20160627             | ubuntu-1404-lts |
> | ubuntu-1510-wily-v20160627               | ubuntu-1510     |
> | ubuntu-1604-xenial-v20160627             | ubuntu-1604-lts |
> | windows-server-2008-r2-dc-v20160623      | windows-2008-r2 |
> | windows-server-2012-r2-dc-v20160623      | windows-2012-r2 |
> | xfstests-201607030209                    | xfstests        |
> +------------------------------------------+-----------------+
>
> and will even use fancy graphics characters if you're using a terminal
> which supports them.  :-)

Putting everything in columns is my thing :) We can do something like that. It should not be so hard to put titles on top and draw some lines, I think, if you set fixed column widths. I'm just not sure if it will be really helpful. What sort of use case do you have in mind (besides git-log --oneline with customizable columns)?

-- 
Duy
Previous: Theodore Ts'oNext: Theodore Ts'o
Message 4 of 18 in “pretty: add format specifiers: %gr, %gt, %gI, gi”
  1. pretty: add format specifiers: %gr, %gt, %gI, giTheodore Ts'o, Jul 10, 2016
  2. Jeff KingJul 10, 2016
  3. Theodore Ts'oJul 10, 2016
  4. Duy NguyenJul 10, 2016
  5. Theodore Ts'oJul 10, 2016
  6. Jeff KingJul 11, 2016
  7. 1/5 doc/rev-list-options: clarify "commit@{Nth}" for "-g" optionJeff King, Jul 11, 2016
  8. 2/5 doc/rev-list-options: explain "-g" output formatsJeff King, Jul 11, 2016
  9. 3/5 doc/pretty-formats: describe index/time formats for %gdJeff King, Jul 11, 2016
  10. Theodore Ts'oJul 11, 2016
  11. Jeff KingJul 12, 2016
  12. Junio C HamanoJul 12, 2016
  13. 4/5 date: document and test "raw-local" modeJeff King, Jul 11, 2016
  14. Theodore Ts'oJul 11, 2016
  15. Jeff KingJul 12, 2016
  16. 5/5 date: add "unix" formatJeff King, Jul 11, 2016
  17. Theodore Ts'oJul 11, 2016
  18. Junio C HamanoJul 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.