refactor: cleanup scripts

This commit is contained in:
Abhishek Keshri 2024-03-17 04:00:27 +05:30 committed by Abhishek Keshri
parent 15b06d5196
commit d2e517d76a
9 changed files with 60 additions and 160 deletions

View file

@ -1,10 +1,6 @@
#!/usr/bin/env bash
# setting the locale, some users have issues with different locales, this forces the correct one
export LC_ALL=en_US.UTF-8
# configuration
# @tmux2k-ping-server "example.com"
# @tmux2k-ping-rate 5
export LC_ALL=en_US.UTF-8
current_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$current_dir"/utils.sh
@ -12,15 +8,12 @@ source "$current_dir"/utils.sh
ping_function() {
case $(uname -s) in
Linux | Darwin)
# storing the hostname/IP in the variable PINGSERVER, default is google.com
pingserver=$(get_tmux_option "@tmux2k-ping-server" "google.com")
pingtime=$(ping -c 1 "$pingserver" | tail -1 | awk '{print $4}' | cut -d '/' -f 2)
echo "$pingtime ms"
;;
CYGWIN* | MINGW32* | MSYS* | MINGW*)
# TODO - windows compatability
;;
CYGWIN* | MINGW32* | MSYS* | MINGW*) ;; # TODO - windows compatability
esac
}
@ -31,5 +24,4 @@ main() {
sleep "$RATE"
}
# run main driver
main