summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorKarthik Nayak <karthik.188@gmail.com>2016-02-17 18:06:16 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-17 22:06:45 (GMT)
commit395fb8f9f4e13f0ca30b93c7b419c22a4625e5c4 (patch)
treed70f0bd2c3233ec4c54ede84c458c4693a713ab0 /ref-filter.c
parent5bd881d998d6475b8a866af00b1a4d4e6b04c2cc (diff)
downloadgit-395fb8f9f4e13f0ca30b93c7b419c22a4625e5c4.zip
git-395fb8f9f4e13f0ca30b93c7b419c22a4625e5c4.tar.gz
git-395fb8f9f4e13f0ca30b93c7b419c22a4625e5c4.tar.bz2
ref-filter: align: introduce long-form syntax
Introduce optional prefixes "width=" and "position=" for the align atom so that the atom can be used as "%(align:width=<width>,position=<position>)". Add Documentation and tests for the same. Helped-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 797f9fe..2255dcc 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -78,7 +78,15 @@ static void align_atom_parser(struct used_atom *atom, const char *arg)
const char *s = params.items[i].string;
int position;
- if (!strtoul_ui(s, 10, &width))
+ if (skip_prefix(s, "position=", &s)) {
+ position = parse_align_position(s);
+ if (position < 0)
+ die(_("unrecognized position:%s"), s);
+ align->position = position;
+ } else if (skip_prefix(s, "width=", &s)) {
+ if (strtoul_ui(s, 10, &width))
+ die(_("unrecognized width:%s"), s);
+ } else if (!strtoul_ui(s, 10, &width))
;
else if ((position = parse_align_position(s)) >= 0)
align->position = position;