babarot / enhancd

:rocket: A next-generation cd command with your interactive filter
2.58k stars 109 forks source link

Getting error after last update #200

Closed augustocdias closed 1 year ago

augustocdias commented 1 year ago

I use jethrokuan/z to also help nagigate between folders. When I call z, it triggers enhancd and when I select a folder I'm getting the following error:

 ~  z mls                                                                                                                                                                                                                                 I
test: Missing argument at index 3
= true
       ^
~/.config/fish/functions/_enhancd_filter_interactive.fish (line 16):
    if test $ENHANCD_USE_ABBREV = true
       ^
in function '_enhancd_filter_interactive'
        called on line 1 of file ~/.config/fish/functions/enhancd.fish
in command substitution
        called on line 78 of file ~/.config/fish/functions/enhancd.fish
in function 'enhancd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 3 of file ~/.config/fish/conf.d/enhancd.fish
in function 'cd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 80 of file /opt/homebrew/Cellar/fish/3.6.1/share/fish/functions/pushd.fish
in function 'pushd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 172 of file ~/.config/fish/functions/__z.fish
in function '__z' with arguments 'mls'
        called on line 25 of file ~/.config/fish/conf.d/z.fish
in function 'z' with arguments 'mls'
~/.config/fish/functions/_enhancd_filepath_walk.fish (line 1): Unknown command. '/Users/augusto/projects/openmls/openmls' exists but is not an executable file.
in command substitution
        called on line 2 of file ~/.config/fish/functions/_enhancd_filepath_walk.fish
in function '_enhancd_filepath_walk'
in function 'sub'
        called on line 7 of file ~/.config/fish/functions/_enhancd_history_update.fish
in function '_enhancd_history_update'
        called on line 1 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in command substitution
        called on line 5 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in function '_enhancd_cd_after'
        called on line 12 of file ~/.config/fish/functions/_enhancd_cd_builtin.fish
in function '_enhancd_cd_builtin' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 92 of file ~/.config/fish/functions/enhancd.fish
in function 'enhancd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 3 of file ~/.config/fish/conf.d/enhancd.fish
in function 'cd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 80 of file /opt/homebrew/Cellar/fish/3.6.1/share/fish/functions/pushd.fish
in function 'pushd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 172 of file ~/.config/fish/functions/__z.fish
in function '__z' with arguments 'mls'
        called on line 25 of file ~/.config/fish/conf.d/z.fish
in function 'z' with arguments 'mls'
~/.config/fish/functions/_enhancd_filepath_walk.fish (line 2): Command not executable
    set -a dirs ($PWD _enhancd_filepath_get_parent_dirs)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '_enhancd_filepath_walk'
in function 'sub'
        called on line 7 of file ~/.config/fish/functions/_enhancd_history_update.fish
in function '_enhancd_history_update'
        called on line 1 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in command substitution
        called on line 5 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in function '_enhancd_cd_after'
        called on line 12 of file ~/.config/fish/functions/_enhancd_cd_builtin.fish
in function '_enhancd_cd_builtin' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 92 of file ~/.config/fish/functions/enhancd.fish
in function 'enhancd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 3 of file ~/.config/fish/conf.d/enhancd.fish
in function 'cd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 80 of file /opt/homebrew/Cellar/fish/3.6.1/share/fish/functions/pushd.fish
in function 'pushd' with arguments '/Users/augusto/projects/openmls/openmls'
        called on line 172 of file ~/.config/fish/functions/__z.fish
in function '__z' with arguments 'mls'
        called on line 25 of file ~/.config/fish/conf.d/z.fish

Calling cd . or cd .. later for example causes further errors:

cd .                                                                                                                                                                                                I
~/.config/fish/functions/_enhancd_filepath_walk.fish (line 1): Unknown command. '/Users/augusto/projects/openmls/openmls' exists but is not an executable file.
in command substitution
        called on line 2 of file ~/.config/fish/functions/_enhancd_filepath_walk.fish
in function '_enhancd_filepath_walk'
in function 'sub'
        called on line 7 of file ~/.config/fish/functions/_enhancd_history_update.fish
in function '_enhancd_history_update'
        called on line 1 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in command substitution
        called on line 5 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in function '_enhancd_cd_after'
        called on line 12 of file ~/.config/fish/functions/_enhancd_cd_builtin.fish
in function '_enhancd_cd_builtin' with arguments '.'
        called on line 92 of file ~/.config/fish/functions/enhancd.fish
in function 'enhancd' with arguments '.'
        called on line 3 of file ~/.config/fish/conf.d/enhancd.fish
in function 'cd' with arguments '.'
~/.config/fish/functions/_enhancd_filepath_walk.fish (line 2): Command not executable
    set -a dirs ($PWD _enhancd_filepath_get_parent_dirs)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
in function '_enhancd_filepath_walk'
in function 'sub'
        called on line 7 of file ~/.config/fish/functions/_enhancd_history_update.fish
in function '_enhancd_history_update'
        called on line 1 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in command substitution
        called on line 5 of file ~/.config/fish/functions/_enhancd_cd_after.fish
in function '_enhancd_cd_after'
        called on line 12 of file ~/.config/fish/functions/_enhancd_cd_builtin.fish
in function '_enhancd_cd_builtin' with arguments '.'
        called on line 92 of file ~/.config/fish/functions/enhancd.fish
in function 'enhancd' with arguments '.'
        called on line 3 of file ~/.config/fish/conf.d/enhancd.fish
in function 'cd' with arguments '.'

I'm running on fish and wez term.

babarot commented 1 year ago

Thank you for the report. Did you restart shell?

augustocdias commented 1 year ago

Yes. The issue also happens in iTerm2

martonperei commented 1 year ago

Got the same error after updating. Fish shell 3.6.1, Mac OS, iterm2. Seems like some easy fixes.

if test $ENHANCD_USE_ABBREV = true should be if test "$ENHANCD_USE_ABBREV" = true set -a dirs ($PWD _enhancd_filepath_get_parent_dirs) should be set -a dirs $PWD (_enhancd_filepath_get_parent_dirs)

babarot commented 1 year ago

@martonperei Thank you for the debug.

@augustocdias Could you test on this branch? https://github.com/b4b4r07/enhancd/tree/babarot/fix-fish

peeviddy commented 1 year ago

@augustocdias try mine too

babarot commented 1 year ago

Thank you for the contribution! @peeviddy

I'm gonna merge your patch soon after checking it works fine.

augustocdias commented 1 year ago

The branches are working fine

babarot commented 1 year ago

Thank you for the checking!

I've merged @peeviddy 's PR and released new version. Thank you all