Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Fish shell support #12

Closed
Globegitter opened this issue Apr 27, 2015 · 8 comments
Closed

Fish shell support #12

Globegitter opened this issue Apr 27, 2015 · 8 comments

Comments

@Globegitter
Copy link

This tool is looking great so far and it woud be great if it would also support fish shell: https://github.com/fish-shell/fish-shell

I tried to simply modify the syntax to fish-shell: [[ -s "$HOME/.avn/bin/avn.sh" ]]; and source "$HOME/.avn/bin/avn.sh" # load avn but it is not working completely since fish also seems to have issues with the square brackets.

What exactly is the first bit doing? That might make it easier to translate to fish.

@ljharb
Copy link

ljharb commented Apr 27, 2015

fwiw, nvm is not compatible with fish, primarily because fish is not POSIX-compliant, and thus supporting it is a major undertaking. See nvm-sh/nvm#303

It's pretty unlikely you'll be able to trivially make any non-fish tool work in fish, but if you find a way that would help nvm, please add it to the above issue :-)

@Globegitter
Copy link
Author

Yep, had this issue for a while, but see https://github.com/passcod/nvm-fish-wrapper which is now also mentioned in the official readme.

In theory the fish-wrapper should work forever since it just runs it in an instance of bash. But I suppose maybe it will work then in the bash_profile. Will look into that.

@wbyoung
Copy link
Owner

wbyoung commented Apr 28, 2015

@Globegitter I'm actually not very good with bash. Here's an explanation of the double brakcets. And the -s indicates that it's checking for a non-zero sized file.

The majority of what you'll need to do is understand what's going on here. Both bash and zsh allow overriding of commands like cd and hooking into them. Some of this has been abstracted into bash_zsh_support.

If this is an undertaking that you're interested in, I'll happily accept a pull request.

This being the first time I've ever heard of Fish, though, I'm going to close this as it's not something that I'll be taking on at this time. Again, happy to accept a pull request for support!

@wbyoung wbyoung closed this as completed Apr 28, 2015
@corysimmons
Copy link

Fish is a very popular shell. Would you mind adding a note (or accepting a PR) to the README stating you don't/won't support it?

@ljharb
Copy link

ljharb commented Nov 27, 2017

By what metric is a shell that’s not POSIX compliant popular?

@corysimmons
Copy link

Anecdotal.

By what metric is any shell used? I can say "chairs are popular" without kicking down doors and issuing a double-blind chair census.

@wbyoung
Copy link
Owner

wbyoung commented Dec 14, 2017

@corysimmons I'm not really sure it makes sense to support it as it can't work with all possible plugins. You'd have to make it work with n only to allow it to work at all.

I'd think that it may make more sense to fork what you want from this project & create something new as it's probably going to end up being quite different in the end from this. Supporting it outright seems as though it would add a lot of specific edge cases (which I'm not too keen to maintain)… I don't really even use this much myself anymore as I'm using Docker more these days.

@ygormutti
Copy link

ygormutti commented Jul 10, 2018

@Globegitter avn is unnecessary for fish users. You can simply hook to PWD changes and run your favorite node version manager directly (I use nvm with fisherman/nvm):

function __nvm_use_on_cd --on-variable PWD --description 'Use Node.js version specified by project'
    if test -e .nvmrc
       nvm use
       return
    end
    
    if test -e .node-version
       nvm use (cat .node-version)
       return
    end
end

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

No branches or pull requests

5 participants