✨ Updated scripts
This commit is contained in:
parent
ff8b1a3b90
commit
dcc085f826
4 changed files with 55 additions and 7 deletions
14
scripts/bgit
14
scripts/bgit
|
|
@ -245,6 +245,8 @@ if [ $numrepos -eq 0 ] ; then
|
||||||
# Otherwise, if there already is a .git directory...
|
# Otherwise, if there already is a .git directory...
|
||||||
else
|
else
|
||||||
|
|
||||||
|
# creates a list of repos and puts them in an array
|
||||||
|
remotearray=($(git remote))
|
||||||
# Grabs all new files
|
# Grabs all new files
|
||||||
newfiles=$(git status --short | grep '??' | awk '{print $2}' | tr '\n' ' ')
|
newfiles=$(git status --short | grep '??' | awk '{print $2}' | tr '\n' ' ')
|
||||||
# Grabs all modified files
|
# Grabs all modified files
|
||||||
|
|
@ -252,6 +254,7 @@ else
|
||||||
# Grabs all deleted files
|
# Grabs all deleted files
|
||||||
deleted=$(git status | grep deleted | awk '{print $2}' | tr '\n' ' ')
|
deleted=$(git status | grep deleted | awk '{print $2}' | tr '\n' ' ')
|
||||||
|
|
||||||
|
|
||||||
# getopts loop for flag -r that reverts back changes in git repo
|
# getopts loop for flag -r that reverts back changes in git repo
|
||||||
while getopts "r" opt; do
|
while getopts "r" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
|
|
@ -290,7 +293,11 @@ else
|
||||||
git reset --hard ${commitarray[$version]}
|
git reset --hard ${commitarray[$version]}
|
||||||
|
|
||||||
# and pushes it to remote repository
|
# and pushes it to remote repository
|
||||||
git remote | xargs -L1 git push --all
|
for ((i = 0; i < numrepos; i++)) ; do
|
||||||
|
git push --force ${remotearray[i]} ;
|
||||||
|
done
|
||||||
|
|
||||||
|
# git remote | xargs -L1 git push --all
|
||||||
|
|
||||||
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
|
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
@ -391,7 +398,10 @@ else
|
||||||
git commit -m "$gitmoji $cmessage" ;
|
git commit -m "$gitmoji $cmessage" ;
|
||||||
|
|
||||||
# pushes the commit to each repository
|
# pushes the commit to each repository
|
||||||
git remote | xargs -L1 git push --all
|
for ((i = 0; i < numrepos; i++)) ; do
|
||||||
|
git push --force ${remotearray[i]} ;
|
||||||
|
done
|
||||||
|
# git remote | xargs -L1 git push --all
|
||||||
|
|
||||||
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
|
echo "${txtblue}bgit script has completed! goodbye!${txtwhite}"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
||||||
37
scripts/dependencycheck
Executable file
37
scripts/dependencycheck
Executable file
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Error handling
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# For styling/colorizing output
|
||||||
|
txtbld=$(tput bold)
|
||||||
|
# txtblue=${txtbld}$(tput setaf 4)
|
||||||
|
# txtgreen=${txtbld}$(tput setaf 2)
|
||||||
|
txtred=${txtbld}$(tput setaf 1)
|
||||||
|
# txtyellow=${txtbld}$(tput setaf 3)
|
||||||
|
txtwhite=${txtbld}$(tput setaf 7)
|
||||||
|
|
||||||
|
|
||||||
|
# Dependency check
|
||||||
|
function dependencycheck()
|
||||||
|
{
|
||||||
|
numdependencies="$#"
|
||||||
|
dependencies=("$@")
|
||||||
|
missingdependencies=0
|
||||||
|
for ((i = 0; i < numdependencies; i++)) ;
|
||||||
|
do
|
||||||
|
if ! command -v "${dependencies[$i]}" &> /dev/null
|
||||||
|
then
|
||||||
|
echo "${txtred}dependency not met: ${dependencies[$i]}${txtwhite}"
|
||||||
|
missingdependencies=$((missingdependencies+1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
#invoke function
|
||||||
|
dependencycheck "$@"
|
||||||
|
|
||||||
|
if [ $missingdependencies -gt 0 ] ; then
|
||||||
|
echo "${txtred}Please install needed dependencies${txtwhite}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
$HOME/scripts/python/pyalarm $1 &> /dev/null 2>&1 &
|
$HOME/scripts/python/pyalarm $1 $2 &> /dev/null 2>&1 &
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,14 @@
|
||||||
#!/bin/python
|
#!/bin/python
|
||||||
|
|
||||||
# https://realpython.com/python-subprocess/
|
# https://realpython.com/python-subprocess/
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
parser = ArgumentParser()
|
parser = ArgumentParser()
|
||||||
parser.add_argument("time", type=int)
|
# parser.add_argument("time", type=int)
|
||||||
|
parser.add_argument("-t", type=int)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
sleep(args.time)
|
sleep(args.t)
|
||||||
subprocess.call(["notify-send", "Time's Up!!",])
|
# sleep(args.time)
|
||||||
|
subprocess.call(["notify-send", "Time's Up!!"])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue