Add git-sync command to fetch from a list of repos
This commit is contained in:
parent
d5ae3dbfc8
commit
7fb360690d
23
git-sync
Executable file
23
git-sync
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env zsh
|
||||||
|
|
||||||
|
autoload -U colors && colors
|
||||||
|
|
||||||
|
git_sync=${GIT_SYNC:-~/.config/git-sync}
|
||||||
|
|
||||||
|
if [ ! -f "$git_sync" ]; then
|
||||||
|
echo "$fg[yellow]warning:${reset_color} sync list does not exist: $git_sync"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
local repos=($(cat $git_sync))
|
||||||
|
if [ ${#repos[@]} = 0 ]; then
|
||||||
|
echo "$fg[yellow]warning:${reset_color} sync list is empty: $git_sync"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for repo in $repos; do
|
||||||
|
print -P "$fg[cyan]synchronizing: $repo${reset_color}"
|
||||||
|
repo="${repo/#\~/$HOME}"
|
||||||
|
git -C "$repo" fetch
|
||||||
|
done
|
22
tasks.yaml
22
tasks.yaml
@ -1,29 +1,11 @@
|
|||||||
---
|
---
|
||||||
- name: git clone private config repository
|
|
||||||
git:
|
|
||||||
repo: git@code.infektor.net:benie/config.git
|
|
||||||
dest: ~/.config/private
|
|
||||||
version: master
|
|
||||||
|
|
||||||
- name: git install macOS packages
|
|
||||||
when: ansible_os_family == "Darwin"
|
|
||||||
homebrew:
|
|
||||||
name: gpg
|
|
||||||
state: latest
|
|
||||||
|
|
||||||
- name: git intall pip packages
|
|
||||||
pip:
|
|
||||||
name: git+https://github.com/kbenzie/git-issue.git
|
|
||||||
extra_args: --user
|
|
||||||
state: latest
|
|
||||||
|
|
||||||
- name: git create symbolic links
|
- name: git create symbolic links
|
||||||
file:
|
file:
|
||||||
state: link
|
state: link
|
||||||
src: '{{item.src}}'
|
src: '{{item.src}}'
|
||||||
dest: '{{item.dest}}'
|
dest: '{{item.dest}}'
|
||||||
with_items:
|
with_items:
|
||||||
- src: ~/.config/git/config
|
|
||||||
dest: ~/.gitconfig
|
|
||||||
- src: ~/.config/git/_git-changes
|
- src: ~/.config/git/_git-changes
|
||||||
dest: ~/.local/share/zsh/site-functions/_git-changes
|
dest: ~/.local/share/zsh/site-functions/_git-changes
|
||||||
|
- src: ~/.config/git/git-sync
|
||||||
|
dest: ~/.local/bin/git-sync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user