aboutsummaryrefslogtreecommitdiff
path: root/.config/fish/functions/envsource.fish
blob: aa0ae2453b9d8ab6269ebbc384a26e47e0db6cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
function envsource
    for line in (cat $argv | grep -v '^#' | grep -v '^\s*$')
        set item (string split -m 1 '=' $line)
        set key $item[1]
        set value (string trim --chars=\'\" $item[2])
        if test (string length $value) -ne 0
            set -gx $key $value
            echo $key
        end
    end
end