mirror of
https://github.com/romkatv/powerlevel10k
synced 2024-12-27 08:22:16 +00:00
add pull-pustream.zsh
This commit is contained in:
parent
5edb47431f
commit
0fc73235e7
30
gitstatus/pull-upstream.zsh
Executable file
30
gitstatus/pull-upstream.zsh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/zsh
|
||||
|
||||
emulate -L zsh
|
||||
setopt err_exit no_unset pipe_fail extended_glob xtrace
|
||||
|
||||
: ${GITSTATUS_DIR:=${${(%):-%x}:A:h}}
|
||||
: ${GITSTATUS_URL:=https://github.com/romkatv/gitstatus.git}
|
||||
|
||||
readonly GITSTATUS_DIR GITSTATUS_URL
|
||||
readonly -a IGNORE=(pull-upstream.zsh README.md)
|
||||
|
||||
function pull() {
|
||||
local repo && repo=$(mktemp -d ${TMPDIR:-/tmp}/gitstatus-pull-upstream.XXXXXXXXXX)
|
||||
trap "rm -rf ${(q)repo}" EXIT
|
||||
git clone $GITSTATUS_URL $repo
|
||||
|
||||
local dst
|
||||
for dst in $GITSTATUS_DIR/**/*(.,@); do
|
||||
local f=${dst#$GITSTATUS_DIR/}
|
||||
(( ! ${IGNORE[(I)$f]} )) || continue
|
||||
local src=$repo/$f
|
||||
[[ -f $src ]] && {
|
||||
mkdir -p ${dst:h} && cp -f $src $dst || return
|
||||
} || {
|
||||
rm $dst
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
pull
|
Loading…
Reference in New Issue
Block a user