Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] _git: offer changed files relative to current directory
- X-seq: zsh-workers 27461
- From: "Alexey I. Froloff" <raorn@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] _git: offer changed files relative to current directory
- Date: Sat, 5 Dec 2009 18:12:03 +0300
- In-reply-to: <20091205124258.GC3344@xxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1259973163-20919-1-git-send-email-raorn@xxxxxxxxxxxx> <20091205120753.GA21684@headley> <20091205124258.GC3344@xxxxxxxxxxxx>
On Sat, Dec 05, 2009 at 03:42:58PM +0300, Alexey I. Froloff wrote:
> Just need pure-zsh "relative" implementation.
Here's my quick'n'dirty code:
relate()
{
local -a what to res
what=( ${(ps:/:)"${${${${1//\/\///}//\/.\///}%%/.}%%/}"} )
to=( ${(ps:/:)"${${${${2//\/\///}//\/.\///}%%/.}%%/}"} )
while (( $#what > 0 )) && (( $#to > 0 )) && [[ $what[1] == $to[1] ]]; do
what[1]=()
to[1]=()
done
while (( $#to > 0 )); do
res+=..
to[1]=()
done
res=( "$res[@]" "$what[@]" )
echo ${(pj:/:)res}
}
relate Completion/Unix/Command/_git Functions/
../Completion/Unix/Command/_git
--
Regards,
Sir Raorn.
Attachment:
signature.asc
Description: Digital signature
Messages sorted by:
Reverse Date,
Date,
Thread,
Author