Comments (8)
Hmm it'd have to be something other than $NAVENAME
, since that's load bearing to determine whether you're in a symlinked named env or direct in the version folder. But it should be straightforward to add a new env, and I can see the value in it. Maybe $NAVEARG
?
from nave.
So if I add a named environment and say nave use my-named-env bash -c 'echo $NAVENAME'
, it will say 'my-named-env'?
from nave.
Yup!
$ nave use my-named-env 16 bash -c 'echo $NAVENAME'
Creating new env named 'my-named-env' using node 16.19.0
my-named-env
from nave.
Once it's created, you don't have to specify a version (or you don't have to initially, but it'll prompt you if it doesn't exist already). So, if it doesn't exist, it's not 100% headless (though you can echo $version | ...
and that'll answer the prompt.)
Also, nave use <name>
is a little bit clever, idk if it's clear from the example above. If the first argument is a valid node semver argument (like 18.0.1
or 16.3
) then it'll create/update the named env to use that. Otherwise, it treats all remaining arguments as a command to run.
$ nave use my-named-env bash -c 'echo $NAVENAME'
my-named-env
$ nave use named-env-that-does-not-exist-yet bash -c 'echo $NAVENAME'
What version of node?
lts, lts/<name>, latest, x.y, or x.y.z > 16
Creating new env named 'named-env-that-does-not-exist-yet' using node 16.19.0
named-env-that-does-not-exist-yet
from nave.
Shipped 3.5.0, which now sets $NAVEVERSIONARG
to the raw version argument provided.
In the case of nave use named-env
without supplying a version, it is set to the resulting full version, because at least that way it's reliably set to something that we know would resolve to the version in use.
One weird side effect of this is that if you don't supply a version, and the named env doesn't yet exist, then it'll prompt the user for an argument but will not set $NAVEVERSIONARG
to that argument. It'd be a bit of refactoring to capture that input in a way that the caller of add_named_env
can get at it, and I figured it's enough of an edge case to not be worth it, but if you'd like to have that consistency, feel free to open a new issue on it.
from nave.
eg:
$ nave use new-named-env bash -c 'echo nva=$NAVEVERSIONARG'
What version of node? 16
Creating new env named 'new-named-env' using node 16.19.0
nva=16.19.0 # <-- would expect "16" here, not "16.19.0"
from nave.
In the case of
nave use named-env
without supplying a version, it is set to the resulting full version
If it is reliably set the original version argument given to nave use
in every context in which the resolution is unambiguous, then that's fine. I can make sure that the resolution is unambiguous. Thanks!
from nave.
The issue is that the argument isn't stored anywhere after the first setup command. So all we know at the point of nave use named
is whatever version it resolved to.
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
- 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 ls-remote returns empty, nave install node fails HOT 2
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.