2024-06-05 20:04:49 +02:00
|
|
|
#!/bin/bash
|
2024-05-06 22:55:03 +02:00
|
|
|
function rgf {
|
|
|
|
if [[ "$1" == "--help" ]]; then
|
2024-06-05 20:04:49 +02:00
|
|
|
# shellcheck disable=SC2140
|
2024-05-06 22:55:03 +02:00
|
|
|
echo "Finde alle Dateien die "\$1" im Namen haben."
|
|
|
|
echo ""
|
|
|
|
echo " Usage: rgf <string>"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "[ERROR] Suchbegriff fehlt..."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if command -v rg >/dev/null ; then
|
2024-06-05 20:04:49 +02:00
|
|
|
rg --ignore-case --files --hidden --glob=!.git/ --*"$1"*
|
2024-05-06 22:55:03 +02:00
|
|
|
else
|
|
|
|
echo "[INFO] ripgrep ist nicht installiert... suche mit 'find'"
|
2024-06-05 20:04:49 +02:00
|
|
|
find . -type f -not -path '*/\.git/*' -name -- *"$1"*
|
2024-05-06 22:55:03 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
function rgi {
|
|
|
|
if [[ "$1" == "--help" ]]; then
|
2024-06-05 20:04:49 +02:00
|
|
|
# shellcheck disable=SC2140
|
2024-05-06 22:55:03 +02:00
|
|
|
echo "Finde alle Dateien die "\$1" im Inhalt haben."
|
|
|
|
echo ""
|
|
|
|
echo " Usage: rgi <string>"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "[ERROR] Suchbegriff fehlt..."
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
if command -v rg >/dev/null ; then
|
|
|
|
rg --ignore-case --hidden --glob=!.git/ "$1"
|
|
|
|
else
|
|
|
|
echo "[INFO] ripgrep ist nicht installiert... suche mit 'grep'"
|
|
|
|
grep --recursive --line-number --ignore-case --exclude-dir=".git" "$1" .
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
function ssh {
|
|
|
|
# benennt das aktuelle tmux-windows nach dem ssh-ziel
|
|
|
|
# baut ssh-verbindung auf
|
|
|
|
if [ -n "${TMUX}" ]; then
|
|
|
|
tmux rename-window "${@: -1}"
|
|
|
|
fi
|
|
|
|
command ssh "$@"
|
|
|
|
if [ -n "${TMUX}" ]; then
|
|
|
|
tmux rename-window "$(hostname -f)"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
function gp {
|
|
|
|
git pull "$@"
|
|
|
|
}
|