aboutsummaryrefslogtreecommitdiff
path: root/.config/fish/functions/load_dots.fish
diff options
context:
space:
mode:
Diffstat (limited to '.config/fish/functions/load_dots.fish')
-rw-r--r--.config/fish/functions/load_dots.fish21
1 files changed, 21 insertions, 0 deletions
diff --git a/.config/fish/functions/load_dots.fish b/.config/fish/functions/load_dots.fish
new file mode 100644
index 0000000..249bea9
--- /dev/null
+++ b/.config/fish/functions/load_dots.fish
@@ -0,0 +1,21 @@
+function load_dots
+ for option in $argv
+ switch "$option"
+ case git
+ load_git
+ case \*
+ printf "error: Unknown option %s\n" $option
+ end
+ end
+end
+
+function load_git
+ envsource ~/.env | while read -l env_var
+ switch $env_var
+ case "GIT_*"
+ # Handle git config variables
+ string lower (string replace -a '_' '.' (string replace -a GIT_ '' $env_var)) | read git_config_key
+ git config --global $git_config_key $$env_var
+ end
+ end
+end