Refactor stuff

This commit is contained in:
Sam A. 2022-07-04 17:36:30 +02:00
parent 9fa15a26a5
commit 70af263278
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

View file

@ -2,9 +2,13 @@ bt() {
(( ${+commands[bluetoothctl]} )) || return 1
if [[ $1 == on ]]; then
connmanctl enable bluetooth
(( ${+commands[connmanctl]} )) \
&& connmanctl enable bluetooth \
|| bluetoothctl power on
elif [[ $1 == off ]]; then
connmanctl disable bluetooth
(( ${+commands[connmanctl]} )) \
&& connmanctl disable bluetooth \
|| bluetoothctl power off
else
bluetoothctl "$@"
fi
@ -30,14 +34,14 @@ doasedit() {
get_ip() {
(( ${+commands[jq]} )) && local JQ="| jq"
local IP=""
local ARGS=""
local ARGS=()
while [[ $# -gt 0 ]]; do
[[ $1 == --ip ]] && IP="?ip=$2" && shift || ARGS="$ARGS $1"
[[ $1 == --ip ]] && IP="?ip=$2" && shift || ARGS+=("$1")
shift
done
eval "curl $ARGS -fsSL 'https://ifconfig.co/json$IP' $JQ"
eval "curl ${ARGS[*]} -fsSL 'https://ifconfig.co/json$IP' $JQ"
}
http() {