Comments (11)
@jacobono
would you mind fixing the issue in the original script you pointed at? 😊
that'd be amazing 😌
from nu_scripts.
I don't think we have an export env
do we?
❯ help export
Export definitions or environment variables from a module.
This command is a parser keyword. For details, check:
https://www.nushell.sh/book/thinking_in_nu.html
Search terms: module
Usage:
> export
Subcommands:
export alias - Alias a command (with optional flags) to a new name and export it from a module.
export def - Define a custom command and export it from a module.
export def-env - Define a custom command that participates in the environment and export it from a module.
export extern - Define an extern and export it from a module.
export module - Export a custom module from a module.
export use - Use definitions from a module and export them from this module.
Flags:
-h, --help - Display the help message for this command
Examples:
Export a definition from a module
> module utils { export def my-command [] { "hello" } }; use utils my-command; my-command
hello
from nu_scripts.
i don't think there is one, that is where i was confused. i am using version 0.81.0
that's why i was thinking maybe it should be let-env BROWSER = "firefox"
or something like that instead maybe?
the file was committed like 2 years ago, did something change between now and then that just doesn't work now?
from nu_scripts.
@kubouch Should export env
be updated to let-env
now?
from nu_scripts.
@fdncred
maybe you're looking for export-env
?
part of the init.nu
file could be written as
export-env { load-env {
BROWSER: "firefox"
CARGO_TARGET_DIR: "~/.cargo/target"
EDITOR: "nvim"
VISUAL: "nvim"
PAGER: "less"
SHELL: "~/.cargo/bin/nu"
JULIA_NUM_THREADS: nproc
HOSTNAME: (hostname | split row '.' | first | str trim)
SHOW_USR: "true"
}}
from nu_scripts.
@amtoine ya, maybe that's what this script needs to be updated with. Is this a naming inconsistency? It kind of crosses both worlds of export
commands and env
commands. At a minimum, it would be helpful to have these commands that cross both worlds have a deprecated command that says, "Please use export-env" or a "did you mean?".
commands with env in them
config env
def-env
export def-env
export-env
hide-env
let-env
load-env
source-env
with-env
commands with export in them
export
export alias
export def
export def-env
export extern
export module
export use
export-env
from nu_scripts.
@amtoine ya, maybe that's what this script needs to be updated with.
i think this is the cleanest way to do it, yup 😌
one can also write something without load-env
export-env {
let-env BROWSER = "firefox"
let-env CARGO_TARGET_DIR = "~/.cargo/target"
let-env EDITOR = "nvim"
let-env VISUAL = "nvim"
let-env PAGER = "less"
let-env SHELL = "~/.cargo/bin/nu"
let-env JULIA_NUM_THREADS = nproc
let-env HOSTNAME = (hostname | split row '.' | first | str trim)
let-env SHOW_USR = "true"
}
but this requires more let-env
s 🤔
Is this a naming inconsistency? It kind of crosses both worlds of
export
commands andenv
commands. At a minimum, it would be helpful to have these commands that cross both worlds have a deprecated command that says, "Please use export-env" or a "did you mean?".
yeah this might be a good idea!
"did you mean?"s are hardcoded in Nushell?
from nu_scripts.
thank you for your help! i was looking at load-env
i just didn't think to combine with export-env
!
i really would not have figured this one on my own so thanks again
this is what i ended up with for init.nu and it works well.
export-env {
load-env {
EDITOR: "hx"
BROWSER: "brave"
PAGER: "less"
HOSTNAME: (hostname | split row '.' | first | str trim)
SHOW_USER: true
LS_COLORS: ([
"di=01;34;2;102;217;239"
"or=00;40;31"
"mi=00;40;31"
"ln=00;36"
"ex=00;32"
] | str join (char env_sep))
PROMPT_COMMAND: { build-prompt }
}
}
load-env
is clear, but what was i missing by not including export-env
? it seemed to me all you would need to do is load the environment (with load-env
or let-env
) but what is the concept i was missing to think "i need to use export-env
to make this work?
from nu_scripts.
i think load-env
only loads the variables into the local-scoped environment.
if it's in a use
d file, it then needs to be exported, with export-env
😋
from nu_scripts.
@amtoine the changes are in the pr now 😀
from nu_scripts.
coool, thanks 😋
eheh, look at this, we can do even better than closing this issue manually 😏
from nu_scripts.
Related Issues (20)
- micromamba support
- `use` of `parse-help` throws `nu::parser::expected_keyword` HOT 1
- Performance issues on man completions HOT 5
- How about nushell-completions? HOT 5
- Job.nu script no longer works HOT 2
- nu_conda list should show which environments are activated HOT 1
- Nuscript's for Pacman
- Module `rbenv` can't export command named same as module. HOT 3
- Add a basic level of CI for this repo HOT 3
- winget-completions.nu with problems? HOT 4
- Conda documentation HOT 3
- Admin commands Question HOT 1
- Fix: nushell at 0.88.0 `start` and `end` are deprecated HOT 1
- tokyo-night theme uses tokyo-storm palette HOT 7
- [new script] is dark_mode mac HOT 1
- The direnv hooks are very confusing HOT 1
- `main` branch CI is not working as expected HOT 1
- git branch cleanup returns errors. HOT 4
- PR 816 Broke Anaconda Activation Support on Windows
- 'winget show' errors on specific packages
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 nu_scripts.