mirror of
https://github.imc.re/void-land/hyprland-void-dots
synced 2025-04-26 17:33:43 +02:00
feat: flags for git pull
This commit is contained in:
parent
7b39e65323
commit
c3efb1c9d9
2 changed files with 39 additions and 8 deletions
38
pull.sh
38
pull.sh
|
@ -1,14 +1,40 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
git_pull() {
|
git_pull() {
|
||||||
git pull
|
if [[ "$1" == "-p" ]]; then
|
||||||
|
git stash
|
||||||
|
git pull
|
||||||
|
git stash pop
|
||||||
|
else
|
||||||
|
git pull
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
git_pull_submodule() {
|
git_pull_submodule() {
|
||||||
git submodule update --recursive --remote
|
if [[ "$1" == "-s" ]]; then
|
||||||
git submodule foreach git checkout main
|
git submodule update --recursive --remote
|
||||||
git submodule foreach git pull origin main
|
git submodule foreach git checkout main
|
||||||
|
git submodule foreach git pull origin main
|
||||||
|
else
|
||||||
|
echo "Usage: $0 -s"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
git_pull
|
while getopts "ps" opt; do
|
||||||
git_pull_submodule
|
case $opt in
|
||||||
|
p)
|
||||||
|
git_pull -p
|
||||||
|
;;
|
||||||
|
s)
|
||||||
|
git_pull_submodule -s
|
||||||
|
;;
|
||||||
|
\?)
|
||||||
|
echo "Invalid option: -$OPTARG" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
git_pull
|
||||||
|
fi
|
||||||
|
|
9
stow.sh
9
stow.sh
|
@ -53,7 +53,7 @@ unstow() {
|
||||||
log "All configs ustowed successfully !"
|
log "All configs ustowed successfully !"
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":suh" opt; do
|
while getopts "ps" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
s)
|
s)
|
||||||
stow
|
stow
|
||||||
|
@ -61,8 +61,13 @@ while getopts ":suh" opt; do
|
||||||
u)
|
u)
|
||||||
unstow
|
unstow
|
||||||
;;
|
;;
|
||||||
*)
|
\?)
|
||||||
display_help
|
display_help
|
||||||
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]]; then
|
||||||
|
display_help
|
||||||
|
fi
|
||||||
|
|
Loading…
Add table
Reference in a new issue