smartcd icon indicating copy to clipboard operation
smartcd copied to clipboard

Trying to autostash function definitions produces odd output on changing directory

Open unikitty37 opened this issue 5 years ago • 0 comments

Attempting to autostash a function in an enter script results in the function being run for every other entry in the file. With the following enter script:

autostash npm() { echo "This is the backend"; echo "npm $@" }
autostash alias rails='docker-compose exec backend rails'
autostash alias rake='docker-compose exec backend rake'

this is output on changing into the directory:

This is the backend
npm smartcd_ondescend_callbacks
This is the backend
npm alias rails=docker-compose exec backend rails
This is the backend
npm alias rake=docker-compose exec backend rake

Placing the npm() function at the end of the file makes no difference to the output.

I don't want to use an alias here as it will output all the parameters passed to npm after the error message, which isn't a great look.

Does autostash work with functions? I ended up defining the function without using autostash in the enter script, and using disable -f npm in the leave script, but it would be really useful to be able to use autostash here…

(I'm using zsh, BTW…)

unikitty37 avatar Jul 29 '20 14:07 unikitty37