[prev in list] [next in list] [prev in thread] [next in thread]
List: coreutils
Subject: Re: PATCH: relpath
From: Pádraig_Brady <P () draigBrady ! com>
Date: 2012-05-14 13:00:06
Message-ID: 4FB101D6.1000904 () draigBrady ! com
[Download RAW message or body]
On 05/14/2012 01:39 PM, Peng Yu wrote:
> On Mon, May 14, 2012 at 3:33 AM, Pádraig Brady <P@draigbrady.com> wrote:
>> On 05/13/2012 04:27 AM, Peng Yu wrote:
>>>> `--relative-base=BASE'
>>>> Only output relative names when both the `--relative-to' and processed
>>>> FILEs are descendants of BASE. Otherwise output the absolute file name.
>>>> Note this option honors the @option{-m} and @option{-e} options
>>>> pertaining to file existence.
>>>
>>> '--relative-to' and '--relative-base' are too long. Would you please
>>> add a one-letter shortcut, such as -t and -b?
>>
>> Well short options are a bit of a trade off.
>>
>> -t or -b would detract from the readability of a command
>> using them and thus would be useful just to save typing.
>> These days though there are other aids to both memory
>> and typing, like shell tab completion and
>> editor auto completion.
>
> I original suggested adding "relpath". I don't agree to bury this
> under realpath. Having realpath for relpath is already awkward and
> inconvenient. I don't think that it is wise having even long option
> names to make it even more inconvenient.
>
> I think that some names in coreutils is not good. This is just one
> instance and should corrected.
>
>> Also a factor is the frequency of use.
>> ls for example is a command used very often,
>> so can benefit from some short options.
>> I see realpath being used less interactively,
>> and more in scripts where readability is more important.
>
> You can't tell for others how frequent they will use it. Just a like,
> a rare disease is rare for a common person. But for persons who have
> the disease it is 100%.
>
> Bottom line, as a convention, for each long name option, there should
> be a short name option, unless there are more than 26x2=52 options, in
> which case the command is too large and should be broken into multiple
> commands.
There are similar medicines for many diseases.
Here is a function you can put in your scripts or shell startup file,
to provide the interface you desired from a relpath command.
relpath() { realpath --relative-to="$2" "$1"; }
cheers,
Pádraig.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic