From: Jakub Narębski Date: Sun, 20 Nov 2016 18:43:07 GMT Subject: Re: [PATCH v7 13/17] ref-filter: add `:dir` and `:base` options for ref printing atoms Message-ID: <51aea3cf-eaba-f909-faa0-00d3998c0d6c@gmail.com> In-Reply-To: W dniu 20.11.2016 o 18:32, Junio C Hamano pisze: > Karthik Nayak writes: > >> We could have lstrip and rstrip as you suggested and perhaps make >> it work together too. But I see this going off the scope of this >> series. Maybe I'll follow up with another series introducing these >> features. Since we can currently make do with 'strip=2' I'll drop >> this patch from v8 of this series and pursue this idea after this. > > My primary point was that if we know we want to add "rstrip" later > and still decide not to add it right now, it is OK, but we will > regret it if we named the one we are going to add right now "strip". > That will mean that future users, when "rstrip" is introduced, will > end up having to choose between "strip" and "rstrip" (as opposed to > "lstrip" and "rstrip"), wondering why left-variant is more important > and named without left/right prefix. Another solution would be to implement 'splice=[,]', where if length is omitted it means to the end; perhaps with special casing (as in Perl) of negative and/or negative . Or implement POSIX shell expansion: %(parameter%word) - Remove Smallest Suffix Glob Pattern. %(parameter%%word) - Remove Largest Suffix Glob Pattern. %(parameter#word) - Remove Smallest Prefix Pattern. %(parameter##word) - Remove Largest Prefix Pattern. Though this one looks like serious overkill... -- Jakub Narębski