Skip to content

Commit

Permalink
Make presets be an option instead of a mode (#75)
Browse files Browse the repository at this point in the history
Make `presets` be an option and not a separate mode.

This enables `wondershaper -p -c` to clear all shaping on whatever
interface is in your configuration file.

Fixes: #74
  • Loading branch information
mattiasb committed Oct 15, 2021
1 parent e9cf905 commit 98792b5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions wondershaper
Expand Up @@ -76,7 +76,8 @@ DSPEED="";
USPEED="";
IFACE="";
IFB="ifb0";
MODE="";
LOAD_PRESETS=false
MODE=""

while getopts hvf:d:u:a:pcs o; do
case "$o" in
Expand All @@ -88,15 +89,15 @@ while getopts hvf:d:u:a:pcs o; do
d) DSPEED="$OPTARG";;
u) USPEED="$OPTARG";;
a) IFACE="$OPTARG";;
p) MODE="presets";;
p) LOAD_PRESETS=true;;
c) MODE="clear";;
s) MODE="status";;
[?]) usage;
exit 1;;
esac;
done;

if [ "$MODE" = "presets" ]; then
if [ "$LOAD_PRESETS" = true ]; then
if [ -f "$CONF" ]; then
# shellcheck disable=SC1090
source "$CONF";
Expand All @@ -111,7 +112,7 @@ fi;



if [[ -n "$MODE" ]] && [[ -z "$IFACE" ]]; then
if [[ -z "$IFACE" ]]; then
echo "Please supply the adapter name for the mode."
echo "";
usage;
Expand All @@ -132,7 +133,7 @@ if [ "$MODE" = "clear" ]; then
exit;
fi;

if { [[ -z "$DSPEED" ]] && [[ -z "$USPEED" ]]; } || [[ -z "$IFACE" ]]; then
if [[ -z "$DSPEED" ]] && [[ -z "$USPEED" ]]; then
usage;
exit 1;
fi;
Expand Down

0 comments on commit 98792b5

Please sign in to comment.