-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_modules.fish
More file actions
executable file
·48 lines (42 loc) · 1 KB
/
Copy pathupdate_modules.fish
File metadata and controls
executable file
·48 lines (42 loc) · 1 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/local/bin/fish
function get_fish_home
if test "$XDG_CONFIG_HOME" != ""
echo $XDG_CONFIG_HOME
else
echo "$HOME/.config/fish"
end
end
function get_modules_home
echo (get_fish_home)/modules
end
function get_modules_definitions_file
echo (get_fish_home)/modules_config.fish
end
function module
set modules_home (get_modules_home)
set module_def $argv_name
set module_repo $argv[1]
set module_path "$modules_home/$argv[2]"
if test (count $argv) -gt 2
set module_branch $argv[3]
else
set module_branch master
end
echo '###'
if test -d $module_path
echo "Pulling $module_path"
cd $module_path ;and git pull; cd -
else
echo "Cloning $module_repo (branch $module_branch) into $module_path"
git clone $module_repo -b $module_branch $module_path
end
end
function update_modules
set modules_definitions_file (get_modules_definitions_file)
set modules_home (get_modules_home)
if test ! -d "$modules_home"
mkdir "$modules_home"
end
source "$modules_definitions_file"
end
update_modules