From: Karthik Nayak Date: Fri, 14 Aug 2015 15:46:32 GMT Subject: Re: [PATCH v10 05/13] ref-filter: implement an `align` atom Message-ID: In-Reply-To: On Thu, Aug 13, 2015 at 1:54 AM, Junio C Hamano wrote: > Karthik Nayak writes: > >> On Wed, Aug 12, 2015 at 10:43 PM, Junio C Hamano wrote: >> ... >>> %(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) >>> ... >>> And that would be following %(align:8). Both 'left' (implied >>> default) and '8' are instructing 'align' what to do. >> >> Will follow this. :) > > I think the most generic way to think about this is to consider that > the most fully spelled form of align would be this: > > %(align:width=12,position=left) > > And another rule you would have is that the user is allowed to omit > "=" when it is obvious from its value. For "align", 'left' > can only possibly be the value for 'position' and similarly '12' for > 'width'. That is why the "objectname" example says "abbrev=8", and > not "abbrev,8", because from the value of "8" without the attribute > name, you cannot tell if the user meant abbrev=8 or magic=8. > > That '"=" can be omitted' rule makes both of these valid > constructs: > > %(align:12,left) %(align:left,12) > Are you sure you want it to be so flexible? I mean It's nice to have it, but it would include a lot more processing, I'd prefer having either the generic type you mentioned about so users know what they're typing or else a predefined way like %(align:,) > Moreover, if you make "left aligned" the default behaviour when > position is not specified, you can make %(align:12) the shortest way > to spell the same thing. Note that I said "if you make"; I do not > offhand know if all the internal callers of this mechanism your > updates to "branch -l" and "tag -l" would want left aligned output > (if so, that is one argument to favor making left-aligned the > implicit default; if not, it may be better to require the position > always specified). Left align is what I'd prefer as default for branch -l and tag -l so that will be done. -- Regards, Karthik Nayak