Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] cd: Append 2nd argument to CWD if 1st is empty



On Friday, December 1st, 2023 at 14:51, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> 

> I'm not opposed to the patch, but you could just cd $PWD-branchname in
> this case.

True. For me personally though, typing $PWD always feels a bit clunky and
unergonomic as I have to hold shift constantly.

> It's also easy to get the desired functionality with a
> wrapper function (admittedly slightly less easy if you also want to
> handle edge cases like cd -L '' foo but you probably don't):
> cd() {
>   if [[ $# == 2 ]] && [[ $1 = "" ]]; then
>     builtin cd $PWD$2
>   else
>     builtin cd "$@"
>   fi
> }

Yes, that is probably what I'll do, if the patch gets rejected. But I am not a
big fan of wrapper functions that have to parse arguments and tend to not want
to break existing functionality through them.

Thanks,
Julian

Attachment: signature.asc
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author