swaync-service-dispatcher: add a usage command
This commit is contained in:
@@ -5,6 +5,17 @@
|
||||
# otherwise we invoke a s6-rc which does not know where to find files.
|
||||
export PATH="/etc/profiles/per-user/$(whoami)/bin:/run/current-system/sw/bin:$PATH"
|
||||
|
||||
usage() {
|
||||
echo "swaync-service-dispatcher <action> <service>"
|
||||
echo ""
|
||||
echo "actions:"
|
||||
echo "- swaync-service-dispatcher print <service>"
|
||||
echo " - prints 'true' or 'false' based on if the service is wanted-up (i.e. started or starting)"
|
||||
echo "- swaync-service-dispatcher toggle <service>"
|
||||
echo " - if the service is up, takes it down, and vice versa"
|
||||
exit 1
|
||||
}
|
||||
|
||||
action="$1"
|
||||
service="$2"
|
||||
|
||||
@@ -34,10 +45,10 @@ stopService() {
|
||||
}
|
||||
|
||||
case "$action" in
|
||||
print)
|
||||
(print)
|
||||
checkActive
|
||||
;;
|
||||
toggle)
|
||||
(toggle)
|
||||
case "$(checkActive)" in
|
||||
false)
|
||||
startService
|
||||
@@ -47,4 +58,7 @@ case "$action" in
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
(*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
Reference in New Issue
Block a user