From 6375b48c701c5962d2921ea0259fd5eb131580c0 Mon Sep 17 00:00:00 2001 From: Julius Riegel Date: Tue, 7 May 2024 08:39:17 +0200 Subject: [PATCH] Add dotenv command to load a dotenv file into the current environment --- content/config/nushell/scripts/utils.nu | 12 ++++++++++++ silo.config.lua | 1 + 2 files changed, 13 insertions(+) diff --git a/content/config/nushell/scripts/utils.nu b/content/config/nushell/scripts/utils.nu index 398fa13..498bded 100644 --- a/content/config/nushell/scripts/utils.nu +++ b/content/config/nushell/scripts/utils.nu @@ -54,3 +54,15 @@ export def --wrapped df [...$args] { ^df ...$args | detect columns --guess } } + +export def --env dotenv [file=".env"] { + if not ($file | path exists) { + err make { msg: $"env file ($file) not found "} + } + ( open $file + | lines + | each { parse "{key}={value}" | first | { $in.key: $in.value} } + | reduce --fold {} {|it, acc| $acc | merge $it } + | load-env $in + ) +} diff --git a/silo.config.lua b/silo.config.lua index 07e66af..0bffb95 100644 --- a/silo.config.lua +++ b/silo.config.lua @@ -62,6 +62,7 @@ config.modules = { 'parallel', 'bat', 'cz-cli', + 'plantuml', }, gui = mod { 'kdePackages.breeze-icons',