summaryrefslogtreecommitdiff
path: root/functions/__z_clean.fish
blob: ae1721a0dc600c2a365699ceb420a3067a377df5 (plain)
1
2
3
4
5
6
7
8
9
10
11
function __z_clean -d "Clean up .z file to remove paths no longer valid"
    set -l tmpfile (mktemp $Z_DATA.XXXXXX)

    if test -f $tmpfile
        while read line
            set -l path (string split '|' $line)[1]
            test -d $path; and echo $line
        end <$Z_DATA >$tmpfile
        command mv -f $tmpfile $Z_DATA
    end
end