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