Re: [PATCH v9 8/9] ls-tree.c: introduce "--format" option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Teng,

On Fri, 7 Jan 2022 at 06:34, Teng Long <dyroneteng@xxxxxxxxx> wrote:

> +--format=<format>::
> +       A string that interpolates `%(fieldname)` from the result
> +       being shown. It also interpolates `%%` to `%`, and
> +       `%xx` where `xx`are hex digits interpolates to character

Above, there is a missing space just before "are". That causes the
manpage to render a little bit funny.

> +       with hex code `xx`; for example `%00` interpolates to
> +       `\0` (NUL), `%09` to `\t` (TAB) and `%0a` to `\n` (LF).
> +       When specified, `--format` cannot be combined with other
> +       format-altering options, including `--long`, `--name-only`
> +       and `--object-only`.
> +

> +Customized format:
> +
> +It's support to print customized format by `%(fieldname)` with `--format` option.

I had to re-read this to understand. How about the following?

    It is possible to print in a custom format by using the `--format`
    option, which is able to interpolate different fields using a
    `%(fieldname)` notation.

Just a suggestion. Feel free to tweak or ignore. :-)

> +For example, if you want to only print the <object> and <file> fields with a
> +JSON style, executing with a specific "--format" like
> +
> +        git ls-tree --format='{"object":"%(object)", "file":"%(file)"}' <tree-ish>
> +
> +The output format changes to:
> +
> +        {"object":"<object>", "file":"<file>"}
> +

Nice!

Martin



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux