audio-control: make conditionals more readable.

This commit is contained in:
Nicolás A. Ortega Froysa 2024-12-30 18:48:15 +01:00
parent 766f64c4a6
commit 82b8648ff6

View File

@ -1,15 +1,21 @@
#!/bin/bash
CACHE_DIR="$HOME/.cache/audio-control"
[ "$#" -eq 0 ] &&
echo "Requires a command. Run with 'help' for a list of commands." &&
if [ "$#" -eq 0 ]
then
echo "Requires a command. Run with 'help' for a list of commands."
exit 1
[ "$#" -gt 1 ] &&
echo "Too many arguments. Run with 'help' for a list of commands." &&
fi
if [ "$#" -gt 1 ]
then
echo "Too many arguments. Run with 'help' for a list of commands."
exit 1
fi
[ -d $CACHE_DIR ] ||
if ! [ -d $CACHE_DIR ]
then
mkdir -p $CACHE_DIR
fi
query_outport() {
active_port="$(pactl list sinks | grep 'Active Port')"