feat(notes): prompt sync status
This commit is contained in:
parent
3de358e878
commit
059a164a50
1 changed files with 5 additions and 1 deletions
|
|
@ -7,7 +7,8 @@ dlob=$(tput sgr0)
|
||||||
notesSync() {
|
notesSync() {
|
||||||
# check if online
|
# check if online
|
||||||
test="git.sr.ht"
|
test="git.sr.ht"
|
||||||
if timeout 0.5 ping -q -c 1 -W 1 $test >/dev/null; then
|
time="0.5"
|
||||||
|
if timeout $time ping -q -c 1 -W 1 $test >/dev/null; then
|
||||||
{
|
{
|
||||||
path="${notes_dir}/"
|
path="${notes_dir}/"
|
||||||
cd "$path"
|
cd "$path"
|
||||||
|
|
@ -15,10 +16,13 @@ notesSync() {
|
||||||
git add .
|
git add .
|
||||||
git commit -m "[bash script] update/add entries" >> /dev/null
|
git commit -m "[bash script] update/add entries" >> /dev/null
|
||||||
git push --quiet
|
git push --quiet
|
||||||
|
echo ">>> Sync success"
|
||||||
} || {
|
} || {
|
||||||
# Report; TODO: write log
|
# Report; TODO: write log
|
||||||
echo ">>> Sync failed"
|
echo ">>> Sync failed"
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
echo ">>> Sync skipped due to timeout ($time)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue