aboutsummaryrefslogtreecommitdiff
path: root/.config/fish/functions/load_dots.fish
blob: 249bea9ca7fb7d8540189f3a068b9d720a076e2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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