Skip to content

Commit

Permalink
Changed occurrences of sys.argv in main to args.
Browse files Browse the repository at this point in the history
  • Loading branch information
LennardKittner committed Jun 24, 2023
1 parent b24755c commit fc00642
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions rivalcfg/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def _render_battery_level(level=None, is_charging=None):

def main(args=sys.argv[1:]):
# Display a message when no argument given
if len(sys.argv) == 1:
if not args:
print("USAGE:\n rivalcfg --help")
sys.exit(1)

Expand All @@ -68,19 +68,19 @@ def main(args=sys.argv[1:]):
# Try to open a mouse
mouse = None
if (
"--print-debug" not in sys.argv
and "--list" not in sys.argv
and "--version" not in sys.argv
and "--update-udev" not in sys.argv
and "--print-udev" not in sys.argv
"--print-debug" not in args
and "--list" not in args
and "--version" not in args
and "--update-udev" not in args
and "--print-udev" not in args
):
try:
mouse = get_first_mouse()
if "--help" not in sys.argv and "-h" not in sys.argv and not mouse:
if "--help" not in args and "-h" not in args and not mouse:
print("E: No supported device found.")
sys.exit(1)
except IOError as error:
if "--help" not in sys.argv and "-h" not in sys.argv:
if "--help" not in args and "-h" not in args:
raise error

cli_parser = argparse.ArgumentParser(prog="rivalcfg", epilog=_EPILOG)
Expand Down

0 comments on commit fc00642

Please sign in to comment.