diff options
author | FivePixels <dylan.bolger00@gmail.com> | 2023-01-28 17:53:08 -0600 |
---|---|---|
committer | test <dylan.bolger00@gmail.com> | 2023-01-28 18:28:14 -0600 |
commit | 64218e084ebf94365db0b00662c1acfb99248f40 (patch) | |
tree | f3041714f415e253f67aa79e4aca5907113aa781 | |
parent | a2a50dae756f17473f7bd8c508c7ae5a0e8d5e3c (diff) | |
download | dots-64218e084ebf94365db0b00662c1acfb99248f40.tar.xz dots-64218e084ebf94365db0b00662c1acfb99248f40.zip |
Add env file for sourcing, load dots feature
-rw-r--r-- | .config/fish/functions/envsource.fish | 7 | ||||
-rw-r--r-- | .config/fish/functions/load_dots.fish | 21 | ||||
-rw-r--r-- | .config/git/config | 5 |
3 files changed, 28 insertions, 5 deletions
diff --git a/.config/fish/functions/envsource.fish b/.config/fish/functions/envsource.fish new file mode 100644 index 0000000..dbcce39 --- /dev/null +++ b/.config/fish/functions/envsource.fish @@ -0,0 +1,7 @@ +function envsource + for line in (cat $argv | grep -v '^#' | grep -v '^\s*$') + set item (string split -m 1 '=' $line) + set -gx $item[1] (string trim --chars=\'\" $item[2]) + echo $item[1] + end +end 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 diff --git a/.config/git/config b/.config/git/config deleted file mode 100644 index dd1d5ca..0000000 --- a/.config/git/config +++ /dev/null @@ -1,5 +0,0 @@ -[user] - name = FivePixels - email = o5pxels@gmail.com -[credential] - helper = store |