-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.fish
More file actions
executable file
·34 lines (31 loc) · 1.31 KB
/
Copy pathinstall.fish
File metadata and controls
executable file
·34 lines (31 loc) · 1.31 KB
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
32
33
34
#!/usr/bin/env fish
if test (count {$argv}) -ge 1
set --function -- root_dir {$argv[1]}/
else
set --function -- remote usr/local/
end
# get from the remote GitHub repository
if set --query --local -- remote
if ! fish_is_root_user
echo (status basename): 'Must be ran as root'
return 1
end
# Setup Cleanup
function cleanup_temporary_repository --description='Nuke temporary repository on exit' --on-event=fish_exit
rm -rf -- {$repository_dir}
end
begin
set --local -- proj_name fish-helpText
set --local -- repository_dir {$proj_name}-(random)
git --filter=blob:none https://github.com/Drazape/{$proj_name}.git "$repository_dir" || return 2
cd {$repository_dir}
end
end
# Populate
for dir in functions comletions
for source in "$root_dir"{$dir}/**.fish
set --local -- output_path {$source} # Same output path in case of no root directory
set --query --local -- root_dir && set --local -- output_path (string split --fields=2 --max=1 -- "$root_dir" {$source}) # Remove root directory from the output path
install -D --mode=644 -- {$source} "$out"/"$remote"share/fish/vendor_{$dir}.d/(string split --fields=2 --max=1 -- {$dir}/ {$output_path} | string replace --all -- / _ | string replace -- {,_}help-text_)
end
end