Comments (5)
Can you use unexport
to avoid polluting sub-shell environments?
unexport ENV
from just.
Thanks for your response. Well, any interaction manually managing shell vars is what I am avoiding for the same reason: it means humans making mistakes from settings which are out of sight in a terminal session on their machine.
We can assume we already have indicated what env we intend with afeldkamp's example current_project := gcloud config get project
which is quite deliberately delegating the decision - this avoids duplicate and potentially contradictory paths.
I understand the just
utility hasn't been designed with "basically" global variables in mind so it's not a simple ask. This is why I mentioned supporting user defined flags as another way to avoid requiring shell variable handling outside of the justfile
such as just test -e dev
. Perhaps something as simple as only adding -e <envString>
support would satisfy my requirements nicely - although it doesn't satisfy the case of delegation - that's of secondary importance from my POV. Thanks.
from just.
Oh, one other thing, you can override just variables on the command line by putting the overrides after just
but before any arguments:
just ENV=dev test
In the above command, ENV
is a just
variable and not an environment variable. Does that work?
from just.
Thanks for your reply. I don't see how I can load an environment file globally using that: x'$ENV'.sh
<-- error: Shell expansion failed: error looking key 'ENV' up: environment variable not found
This example by afeldkamp is an example of what I am looking for. It feels like to me that just variables
are not first class citizens and this leads to reliance on env variables. And yet, I can't turn this ENV variable into something useful because set dotenv-filename
won't work with just vars as in the below
set dotenv-filename := "{{ENV}}.env". # error
Maybe I could call another recipe in the dependency of every recipe to set up variables for global env settings... IDK if that would work. Overall, variable scope limitations are coming up against just var
vs env var
quirkyness, meets up against variable file loading limitation, meets command line argument passing limitations, and something basic like this IMHO shouldn't be that hard in what seems otherwise a very useful tool.
- What about support for sub-recipies to allow variable sharing?
- What about supporting a getopts style of variable passing on the command line? (with an option to allow them to be environment vars OR just vars via setting).
Thanks.
from just.
Ah, sorry, you're right. Yah, just environment variables won't work there.
Can you do just -E dev.env test
to load the dev environment? This avoids needing to set an environment variable, and is very close to just test -e dev
which you suggested above.
from just.
Related Issues (20)
- Documentation: Relative path issue with `justfile_directory()` HOT 3
- Bash completion script: recipe names are not completed after flags
- Treat paths in submodule relative to directory of root `.justfile` HOT 1
- Neovim syntax highlighting not working when adding Documentation Comment HOT 3
- Feature Request: `Just` a Quick Start Guide for Implementing Custom Attribute Recipes HOT 2
- Wrong number of arguments error incorrectly says functions take zero arguments HOT 2
- [feature request] user-defined functions HOT 2
- LSP?
- Add a --list-paths to output list of recipe paths only HOT 4
- Submodules should be groupable (or have their own group) HOT 6
- Passing arguments for python different than node? I needed to add -- HOT 4
- Parser support for attributes with multiple arguments HOT 1
- Module improvement tracking issue HOT 2
- No .ps1 extension added when pwsh.exe is started via third-party tool HOT 6
- Possible to get autocompletions working in Warp?
- dotenv-path unexpectedly loads .env from parent directory HOT 1
- [Feature Request] `just global init-rust`; an ability to define global `Justfile` that will run commands anywhere on your machine. HOT 2
- Stabilize `[script(…)]` attribute HOT 6
- Comments Ending in Backslash also Comment following Command 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 just.