Re: [PATCH v10 05/13] ref-filter: implement an `align` atom
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 12, 2015, 17:13 UTC
- Message-ID
- <xmqqpp2sl9au.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <CAOLa=ZTnS0kL=CK8Lx-brO0tryB5YzOFUpapsM4LMW-m2Yf9pw@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 13 quoted lines
> On Wed, Aug 12, 2015 at 12:22 AM, Junio C Hamano <gitster@pobox.com> wrote: > >> Minor nits on the design. %(align:<width>[,<position>]) would let >> us write %(align:16)...%(end) and use the "default position", which >> may be beneficial if one kind of alignment is prevalent (I guess all >> the internal users left-align?) %(align:<position>,<width>) forces >> users to spell both out all the time. >> > > Isn't that better? I mean It sets a format which the others eventually > can follow > %(atom:suboption,value). > For example: %(objectname:abbrev,size)
No, I do not think it is better. First of all, the similarity you are perceiving does not exist. For 'objectname:abbrev', the 'size' is a property of the 'abbrev'. For 'align:left', the 'width' is not a property of the position. It is a property given to 'align' (i.e. you have this many display columns to work with).
Also, if there are ways other than 'abbrev' that '8' could affect the way how %(objectname) is modified, then it should be spelled as %(objectname:abbrev=8). To specify two modification magics, each of which takes a number, the user would say e.g.
%(objectname:abbrev=8,magic=4)
The syntax %(objectname:abbrev,size) would not allow you to extend it nicely---you would end up with %(objectname:abbrev,8,magic,4) or something silly like that.
Seeing your %(objectname:abbrev,size), I'd imagine that you are assuming that you will never allow any magic other than 'abbrev' that takes a number to %(objectname). And under that assumption %(objectname:8) would be a short-hand for %(objectname:8,abbrev).
And that would be following %(align:8). Both 'left' (implied default) and '8' are instructing 'align' what to do.