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

Fix __fasd_run.fish eval bug #20

Merged
merged 1 commit into from
Mar 8, 2021
Merged

Conversation

AbysmalBiscuit
Copy link
Contributor

@AbysmalBiscuit AbysmalBiscuit commented Mar 7, 2021

This PR fixes issues #16, #17, and #18.

The fix adds a function that expands variables without evaluating the passed string in the __fasd_run function.

This allows constructs such as redirections, loops, glob expansions, etc... to not be affected by the fish_postexec hook.
This lets fasd take account of relative directories.

The following is an example of save variable expansion when a for loop is passed:

$ set folders foo bar baz
$ __fasd_expand_vars 'for f in $folders; echo \$folders; cd $f; cd $abc; echo $folders; end'
for
f
in
foo
bar
baz
echo
\$folders
cd
f
cd
abc
echo
folders
end

Variables are also expanded correctly if the input is multi-line:

$ set folders foo bar baz
$ __fasd_expand_vars 'for f in $folders
  echo \$folders
  cd $f
  cd $abc
  echo $folders
end'
for
f
in
foo
bar
baz
echo
\$folders
cd
f
cd
abc
echo
folders
end

Fix eval bug causing unexpected behaviour with pipes, redirections,
and variable expansion.
@gretel gretel merged commit 9a16edd into fishgretel:master Mar 8, 2021
@shaharz shaharz mentioned this pull request Mar 10, 2021
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

Successfully merging this pull request may close these issues.

2 participants