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>
This commit is contained in:
committed by
Junio C Hamano
parent
5bd881d998
commit
395fb8f9f4
10
ref-filter.c
10
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;
|
||||
|
||||
Reference in New Issue
Block a user