Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

use default values for unset environment variables #11

@amtoine

Description

@amtoine

until now, all the scripts assume the environment variables they use are set, either in env.nu or in the current interactive shell with a manual let-env VAR = val.

however, this is error prone when used on another config than man which sets all the variables, 'cause i use them

i want to use default values to make sure all the environment variables are set at runtime 👍

an example

  • let vm_directory = ($env.QUICKEMU_HOME | path join $os) in vm.nu#L54 would become
let vm_directory = (
  $env | get -i QUICKEMU_HOME | default "~/.local/share/quickemu" | path expand
  | path join $os
)
  • let path = ($env.GHQ_ROOT | path join $repo) in repo.nu#L100 would become
let path = (
  $env | get -i GHQ_ROOT | default "~/.local/share/ghq" | path expand
  | path join $repo
)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions