Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when running commands with wildcards #16

Open
externl opened this issue Dec 15, 2020 · 4 comments
Open

Error when running commands with wildcards #16

externl opened this issue Dec 15, 2020 · 4 comments

Comments

@externl
Copy link

externl commented Dec 15, 2020

See example

❯ fish -v
fish, version 3.1.2
❯ fasd --version
1.0.1
~/workspace/fasd
❯ ls
a.log  b.log  c.log

~/workspace/fasd
❯ rm -rf *log
~/.config/fish/conf.d/__fasd_run.fish (line 1): No matches for wildcard '*log'. See `help expand`.
echo rm -rf *log
            ^
in command substitution
	called on line 1 of file ~/.config/fish/conf.d/__fasd_run.fish
in command substitution
	called on line 4 of file ~/.config/fish/conf.d/__fasd_run.fish
in function '__fasd_run' with arguments 'rm\ -rf\ \*log'
in event handler: handler for generic event 'fish_postexec'

~/workspace/fasd
❯ ls
(files were removed)
@externl externl changed the title Errors when running commands with wildcards Error when running commands with wildcards Dec 15, 2020
@ianhomer
Copy link

ianhomer commented Jan 19, 2021

the __fasd_run command is being run after every command. If it should only be run after something like the following might help ...

function __fasd_run -e fish_postexec -d "fasd takes record of the directories changed into"
  set -lx RETVAL $status
  if test (string sub --length 3 $argv) = "cd " -a $RETVAL -eq 0 
    # if there was no error
    command fasd --proc (command fasd --sanitize (eval echo "$argv") | tr -s " " \n) > "/dev/null" 2>&1 &
  end
end

I'm surprised that this extension is using this postexec on all commands - which sounds a little execessive. I'd have thought setting up an alias for cd (which also passes argument to fasd) would be more appropriate. Not sure all the use cases for this and not entirely sure this right ... any how, food for thought.

I created an experiment for this at master...ianhomer:master - however this is a breaking change, so alternative suggestions welcome

@gretel
Copy link
Member

gretel commented Jan 26, 2021

thanks, happy to accept PR.

@ianhomer
Copy link

ianhomer commented Feb 7, 2021

I've created PR - it probably needs peer review and iteration, since I wouldn't be surprised if there are side effects for some people - e.g. the opinionated override of cd and loss of implicit behaviour on fish postexec.

@gretel
Copy link
Member

gretel commented Mar 8, 2021

folks, have switched to elvish - looking for new maintainer(s) for all of https://github.com/fishgretel!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants