blob: 541b5bd7355c9dcf83767379a87fe5dbf507e0da (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/usr/bin/env fish
function prepare_directories
if not test -d "$LOCAL_BIN"
mkdir "$LOCAL_BIN"
end
if not test -d "$LOCAL_SCRIPTS"
echo "$LOCAL_SCRIPTS not found"
return 1
end
end
function install_scripts
prepare_directories
for script in "$LOCAL_SCRIPTS"/*
if string match -q "#!*" (head -n1 "$script")
string match -rq '^(?<filename>.*)(?<ext>\.[^.]*)$' (basename "$script")
set symlink "$LOCAL_BIN/$filename"
if test -L "$symlink"
echo "$filename" already exists
continue
end
ln -s "$script" "$symlink"
echo "$filename symlinked"
end
end
end
|