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

does not work with fish shell #2

Closed
omnidan opened this issue Sep 19, 2015 · 7 comments
Closed

does not work with fish shell #2

omnidan opened this issue Sep 19, 2015 · 7 comments
Labels

Comments

@omnidan
Copy link

omnidan commented Sep 19, 2015

I added the alias as instructed, when running prm, I get the following error:

'case' builtin not inside of switch block
~/dev/notmine/prm/prm.sh (line 15): case "$1" in
                                    ^
from sourcing file ~/dev/notmine/prm/prm.sh
    called on line 151 of file /usr/local/Cellar/fish/2.2.0/share/fish/config.fish

in function '.'
    called on line 1 of file -

in function 'prm'
    called on standard input

source: Error while reading file '/Users/dan/dev/notmine/prm/prm.sh'
@FredDeschenes
Copy link
Contributor

Yeah I'm trying to get this working on fish too. I'm afraid it won't work :(

Since all the prm scripts are ran from bash, as soon as this exits and you're back in fish, all the cd-ing and whatnot you did won't matter, as it was in a different shell.

I might port this to fish someday, but it'll have to be a different implementation with fish functions (unless someone as a better idea, I'm far from being an expert at fish scripting).

EDIT: Fyi 'sourcing' the prm script inside fish won't work as it's written for bash.

@omnidan
Copy link
Author

omnidan commented Sep 19, 2015

@FredDeschenes alright, keep me updated here if you ever develop a fish port :)

@EivindArvesen
Copy link
Owner

@FredDeschenes is completely right.

As I don't have much experience with fish, I don't know the details of the compatibility-issues between it and bash.

However (and I'm just spitballing here):
Wouldn't making the hashbang directives (in prm as well as the generated scripts) more ambiguous (i.e. sh instead of bash) and/or removing it from prm entirely if fish is not bourne-compatible, and changing the case in @omnidan's original comment to if-tests make the script fish-compatible?

@FredDeschenes
Copy link
Contributor

@eivind88 Well compatibility-wise, fish just cannot source bash scripts, their scripts being so different.
You can make prm run in fish by adding a 'prm' function

function prm
    bash /path/to/prm $argv
end

but this runs the script in a different shell, so it's basically a noop.

Also, since the scripts are sourced inside bash, they have to be bash scripts themselves, so we can't use any fish functionality with them.

EDIT : To get an idea of how different they are.

@EivindArvesen
Copy link
Owner

I was thinking more in the vein of (something like) fish prm.sh and not explicitly sourcing other scripts in bash (i.e. leaving it ambiguous so that whatever shell is used is tried), but I've since discovered that there are some major differences in syntax that make them incompatible.

So it indeed appears that prm won't work with fish shell unless it is explicitly ported.

@FredDeschenes
Copy link
Contributor

Shameless plug, but I've mostly ported prm for fish here.

Report any issues you might have (or create pull requests for the couple of missing features :P)!

@EivindArvesen
Copy link
Owner

Great job!
I'll add a link to your port in the prm readme.

EivindArvesen added a commit that referenced this issue Sep 19, 2015
Mention pull request etiquette in readme
Add link to FredDeschenes' fish port in readme (addresses issue #2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants