diff options
-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 |