Slimmer code in main

This commit is contained in:
Nicola 2023-10-20 18:47:06 +02:00 committed by GitHub
parent 5f3b9204c2
commit a1a0fa255c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -158,21 +158,20 @@ function args() {
} }
function main() { function main() {
# Handle the chosen required flag # Get pid by a required flag
if [ "$FLAG_ACTIVE" = true ]; then if [ "$FLAG_ACTIVE" = true ]; then
getPidByActive getPidByActive
toggleFreeze
elif [ -n "$FLAG_PID" ]; then elif [ -n "$FLAG_PID" ]; then
getPidByPid "$FLAG_PID" getPidByPid "$FLAG_PID"
toggleFreeze
elif [ -n "$NAME_FLAG" ]; then elif [ -n "$NAME_FLAG" ]; then
getPidByName "$NAME_FLAG" getPidByName "$NAME_FLAG"
toggleFreeze
elif [ "$FLAG_PROP" = true ]; then elif [ "$FLAG_PROP" = true ]; then
getPidByProp getPidByProp
toggleFreeze
fi fi
# Suspend or resume process
toggleFreeze
# Run these functions after PID is obtained # Run these functions after PID is obtained
if [ $INFO -eq 1 ]; then printInfo; fi if [ $INFO -eq 1 ]; then printInfo; fi
if [ $SILENT -ne 1 ]; then sendNotification; fi if [ $SILENT -ne 1 ]; then sendNotification; fi