Comments (7)
I have discussed this idea with a few people in meatspace and on IRC, but never in a github issue. Thanks for the nudge :)
- We're not going to "port nave to fish". That's just silly. Nave itself will remain a bash program.
- I would like to add support for fish, in the same sense that nave supports zsh users, by dropping them into a zsh shell.
Here's a rough outline of how nave works:
- You type some nave command telling it what version you want to run (perhaps by specifying a version, perhaps by specifying a keyword like "stable")
- Nave sets up the binaries in its working dir if they're not already there (builds node, unpacks the binary tgz, whatever)
- Nave runs the shell of your choice (bash by default, but zsh is also supported) in such a way that the
PATH
and other environment variables are set up so that the desired node version is the one you'll get by default.
The step 3 is the part that's easy for bash, kinda tricky/buggy for zsh, and not implemented for fish.
The easiest way to do it is to say "run the shell, and before dropping into user-interactive mode, run this specified script file". So, instead of running ~/.bashrc
, it'll run this file instead. With bash, this is super easy, you just specify the specific file with --rcfile <filename>
when you invoke bash. With zsh, it's a bit wonky; you can specify the folder with an environment variable (!!), but the file must be named .zshenv
.
So, we have this file named .zshenv
which gets dumped in the nave dir at ~/.nave/.zshenv
, and when we invoke bash, we do bash ... --rcfile=~/.nave/.zshenv
and when we do zsh, we do ZDOTDIR=~/.nave zsh ...
(and then have to unset the ZDOTDIR
in the file, or else it'll get screwey.)
The tricky bit here is that zsh and bash are both mostly-sh-compatible, so you can pretty easily write a single rc file that works with both. But fish is a dramatically different language, so the task is:
- Figure out how to invoke fish with an rc file we control.
- Write a fish rc file that does the same stuff that nave's
.zshenv
does, but in fish lingo. - Detect with reasonable accuracy whether the user is using fish, and if so, spawn a fish shell.
Patch welcome! Happy to answer any questions and provide guidance along the way if anyone is interested in doing this. I am not a fish user, and unlikely to ever get to it myself.
Probably the best place to start is with man fish
.
from nave.
@MrBri You might find https://github.com//passcod/nvm-fish-wrapper helpful. This is what I'm using to get nvm working with fish, including iojs support.
from nave.
I have experimented a little and come up with this michaeljones/nave@cea3eb2 which appears to work though I've yet to test it thoroughly and would welcome feedback. I'm not sure if it is good enough for merging but perhaps others would find it useful.
from nave.
@michaeljones I left some really minor nitpick suggestions on the commit.
I think the approach is clever! However, I'd be a little bit concerned if fish's startup scripts set a PATH
environment variable explicitly, since that'll mess with the nave startup script.
from nave.
As far as I can tell, fish doesn't use a startup script or set the PATH explicitly... so, maybe this is fine? Wanna send a PR?
from nave.
Hi, thanks for the feedback. Happy to clean it up a bit. Your suggestions are all very reasonable I just didn't have the right "PR" mindset when trying to get it working.
Fish does have a ~/.config/fish/config.fish
file that acts like a .bashrc
file and it also sources other files in the ~/.config/fish
directory. I can't see a way to stop it though. The docs don't list something obvious. I though maybe combining a file argument with the --interactive
flag might work but no luck.
Personally I'm ok working with tools that result in my standard rc file or fish.config
being sourced multiple times and I just assume it is my responsibility to make sure that it does no harm. I can imagine wanting to avoid it though if possible. Perhaps listing it as a known issue for fish support is enough? Or perhaps I'm misreading the situation.
Cheers!
from nave.
Published on 2.2.0
from nave.
Related Issues (20)
- shasum mismatch HOT 2
- shasum file in cache broken HOT 2
- Use the tab delimited file in the node dist folder instead of parsing html
- How to delete a named environment HOT 2
- How would I use environment variables from the parent shell? HOT 1
- Nave strips off `-n` from arguments
- Auto fails using fish as nave_run executed with exec HOT 1
- macOS install with brew HOT 1
- Named version does not link npx
- Unable to install any node with nave on Windows 10. HOT 1
- unsupported ARM architecture HOT 1
- Fallback to .nvmrc if .naverc isn't specified for nave auto HOT 4
- Q: Can I control where the node versions are installed? HOT 2
- This repository is huge. What is the universal recommended way to install only the files needed to run nave? HOT 2
- Is it possible to define environment variables, or specify a shell script to be sourced, per environment? HOT 12
- Cannot retrieve unmodified argument to `nave use` from environment HOT 8
- Nave caches 500s on index fetch HOT 2
- Clarify that `uninstall` can be used to remove named envs
- lts no longer works as a version HOT 4
- nave install/use version - Fails to install node if user has a shell alias or function called `shasum`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nave.