Closed texastoland closed 5 months ago
I'm not sure I'd recommend set-env in our official docs when it's not officially a part of nushell yet.
Yeah that's why I didn't imply it's standard in any way. Just makes a day 1 tricky task easier. I have no reservation about removing that block regardless!
Pasting here in case we ever add it back:
::: tip
Try downloading the [`set-env`](https://github.com/nushell/nu_scripts/blob/main/stdlib-candidate/std-rfc/set-env.nu) command in order to _merge_ nested `$env` values at any depth:
```nu
set-env config.<field name> <field value>
```
You can optionally `--append` list settings such as [hooks](/book/hooks.md).
:::
I'm fine with path add
since it's in the stdlib, just not set-env
since it's not there yet. Maybe you just deleted the wrong one?
My bad fixed 🙉
@fdncred I added 2 infra lines to enable my live preview in the description:
+const [ciUser, ciRepo] = process.env.GITHUB_REPOSITORY?.split('/') ?? []
export default defineUserConfig({
+ base: ciRepo && ciUser !== 'nushell' ? `/${ciRepo}/` : '/',
to enable my live preview in the description
I'd guess this isn't a good idea because it's specific to your environment and no one else's.
You can try it in your own fork by enabling actions there 💯
Are you saying this is a github thing or something specific to your env vars?
Added comments for maintenance:
+// default env from the deploy GitHub action
+// e.g. ciUser = nushell and ciRepo = nushell.github.io
+// both default to undefined if the env is undefined
const [ciUser, ciRepo] = process.env.GITHUB_REPOSITORY?.split('/') ?? []
export default defineUserConfig({
+ // set the base URL to ciRepo dir if it's a fork
+ // keep the default root if not
base: ciRepo && ciUser !== 'nushell' ? `/${ciRepo}/` : '/',
Also in CONTRIBUTING.md
:
## Enabling a Preview URL From Your Fork
Just enable GitHub actions in your repo settings. That's all! It will start deploying the next time you push to `main`.
ok, thanks
3 New "Tips"
std path add
to simplify editing the system pathset-env
from nu_scripts to simplify editing nested configsAdditional Amendments:
env.nu
vsconfig.nu
upsert
is necessaryconfig.nu
not loading non-interactivelynuopen
command to alias$env.PATH
snippet more conventionally