bash: Funktionen besser dokumentiert
This commit is contained in:
parent
a2af7db0ef
commit
ad636d89b0
1 changed files with 20 additions and 20 deletions
40
.bash_extra
40
.bash_extra
|
@ -46,11 +46,11 @@ function sgc {
|
|||
case "$1" in
|
||||
--help)
|
||||
echo "Suche in der kompletten git-history nach "\$1""
|
||||
echo "sgc = search git commit"
|
||||
echo "sgc <suchbegriff>"
|
||||
echo ""
|
||||
echo " Usage: sgc <Suchbegriff>"
|
||||
;;
|
||||
"")
|
||||
echo "Suchbegriff fehlt..."
|
||||
echo "[ERROR] Suchbegriff fehlt..."
|
||||
;;
|
||||
*)
|
||||
git grep "$1" $(git rev-list --all)
|
||||
|
@ -59,14 +59,14 @@ function sgc {
|
|||
function m2m {
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
echo "Sende Datei "\$2" per Mail; Betreff = "\$1""
|
||||
echo "m2m = mail2me"
|
||||
echo "m2m <Pfad zu Datei> <Betreff>"
|
||||
echo ""
|
||||
echo " Usage: m2m <Pfad zu Datei> <Betreff>"
|
||||
else
|
||||
if [ ! -f "$2" ]; then
|
||||
echo "Dateipfad fehlt..."
|
||||
echo "[ERROR] Dateipfad fehlt..."
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
echo "Betreff fehlt..."
|
||||
echo "[ERROR] Betreff fehlt..."
|
||||
else
|
||||
echo "$1" | mail -s "$1" -A "$2" michael.grote@posteo.de
|
||||
fi
|
||||
|
@ -76,11 +76,11 @@ function m2m {
|
|||
function psk {
|
||||
if [[ "$1" == "--help" ]]; then
|
||||
echo "Beende Prozess "\$1""
|
||||
echo "psk = ps kill"
|
||||
echo "psk <prozessname>"
|
||||
echo ""
|
||||
echo " Usage: psk <prozessname>"
|
||||
else
|
||||
if [ -z "$1" ]; then
|
||||
echo "Prozessname fehlt..."
|
||||
echo "[ERROR] Prozessname fehlt..."
|
||||
else
|
||||
ps -ef | grep "$1" | grep -v grep | awk '{ print $2 }' | xargs kill -9
|
||||
fi
|
||||
|
@ -90,17 +90,17 @@ function rgf {
|
|||
if [[ "$1" == "--help" ]]; then
|
||||
echo "Finde alle Dateien die "\$1" im Namen haben."
|
||||
echo ""
|
||||
echo " Usage: rgf <string>"
|
||||
echo " Usage: rgf <string>"
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
echo "Suchbegriff fehlt..."
|
||||
echo "[ERROR] Suchbegriff fehlt..."
|
||||
return 1
|
||||
fi
|
||||
if command -v rg >/dev/null ; then
|
||||
rg --files -g *"$1"* --hidden
|
||||
else
|
||||
echo "ripgrep ist nicht installiert... suche mit 'find'"
|
||||
echo "[INFO] ripgrep ist nicht installiert... suche mit 'find'"
|
||||
find . -type f -name *"$1"*
|
||||
fi
|
||||
}
|
||||
|
@ -108,17 +108,17 @@ function rgi {
|
|||
if [[ "$1" == "--help" ]]; then
|
||||
echo "Finde alle Dateien die "\$1" im Inhalt haben."
|
||||
echo ""
|
||||
echo " Usage: rgi <string>"
|
||||
echo " Usage: rgi <string>"
|
||||
return 0
|
||||
fi
|
||||
if [ -z "$1" ]; then
|
||||
echo "Suchbegriff fehlt..."
|
||||
echo "[ERROR] Suchbegriff fehlt..."
|
||||
return 1
|
||||
fi
|
||||
if command -v rg >/dev/null ; then
|
||||
rg -i "$1"
|
||||
else
|
||||
echo "ripgrep ist nicht installiert... suche mit 'grep'"
|
||||
echo "[INFO] ripgrep ist nicht installiert... suche mit 'grep'"
|
||||
grep -r -n -i "$1" .
|
||||
fi
|
||||
}
|
||||
|
@ -137,12 +137,12 @@ function gcm {
|
|||
function gc {
|
||||
case "$1" in
|
||||
--help)
|
||||
echo "git checkout <branch>"
|
||||
echo "versucht erst einen lokalen checkout, danach von dem Remote-Repository"
|
||||
echo "gc <branch>"
|
||||
echo "Versuche lokalen checkout, wenn der Branch nicht vorhanden ist versuche eine checkout aus dem Remote-Repository."
|
||||
echo ""
|
||||
echo " Usage: gc <branch>"
|
||||
;;
|
||||
"")
|
||||
echo "Branch fehlt..."
|
||||
echo "[ERROR] Branch fehlt..."
|
||||
;;
|
||||
*)
|
||||
git checkout $1 || git checkout -b $1 origin/$1
|
||||
|
|
Loading…
Reference in a new issue