coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: relpath


From: Pádraig Brady
Subject: Re: PATCH: relpath
Date: Mon, 02 Jan 2012 11:23:44 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

On 12/31/2011 11:27 AM, Jim Meyering wrote:
> Pádraig Brady wrote:
> ...
>>> Reading only the documentation for --relative-base=FILE,
>>> I am not sure how it works:
>>>
>>> `--relative-base=FILE'
>>>      Ensure both the `--relative-to' and processed files are
>>>      subdirectories of FILE, or otherwise output the absolute file name.
>>>      Note this option honors the `-m' and `-e' options pertaining to
>>>      file existence.
>>>
>>> An example or two would help a lot.
>>
>> I'll add something along these lines:
> 
> Thanks.
> 
>> $ realpath --relative-to=/usr /tmp /usr/bin
>> ../tmp
> 
> I see two lines of output.  I guess you missed the latter?
> 
>     $ ./realpath --relative-to=/usr /tmp /usr/bin
>     ../tmp
>     bin
> 
>> $ realpath --relative-base=/usr --relative-to=/usr /tmp /usr/bin
>> /tmp
>> bin
> 
> Good.  That makes it clearer.
> The "Ensure" threw me.  It's not really ensuring it.
> Maybe something like this?
> 
>    `--relative-base=BASE'
>         When both the `--relative-to' file and a listed FILE are
>         descendants of BASE, print a BASE-relative name for FILE.
>         Otherwise, print FILE's absolute name.
>         Note this option honors the `-m' and `-e' options pertaining to
>         file existence.
> 
> There's probably more to consider when the --relative-to= and
> --relative-base= specified names are different, but I haven't
> thought about that.

Well it's setting a BASE, past which "../" will not be generated for.
This does seem fairly useful and provides compatibility with `relpath -d ...`.
I went with:

`--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.

I'll apply the full patch soon,
unless there are more comments.

cheers,
Pádraig.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]