[PATCH 2 of 2] template: add pad function for padding output
Matt Mackall
mpm at selenic.com
Sat Jan 18 03:42:00 UTC 2014
On Fri, 2014-01-17 at 00:45 -0800, Durham Goode wrote:
> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1389946608 28800
> # Fri Jan 17 00:16:48 2014 -0800
> # Node ID 77cf62dd2af0b5631a2864744e720e61ad4cde6a
> # Parent b18359a70b640d2aeb3f4afd1c8e47d775402b8e
> template: add pad function for padding output
>
> Adds a pad template function with the following signature:
>
> pad(text, width, right=False, fillchar=' ')
I like it, but I'm not pleased with the way the third argument works.
Might want to make it the last arg.
I'm tempted to say setting a negative width to get right-aligned would
be better, if still kludgey.
> + $ hg log --template '{pad("{shortestnode}", "20")} {author|user}\n'
Unfortunate dependence on patch 1. Please test that
+ $ hg log --template '{pad(rev, "20")} {author|user}\n'
..or something else without recursive templating does the right thing.
Let's revisit this after Feb 1.
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list