diff --git a/etherlight.py b/etherlight.py index a32c9fa..2e89391 100755 --- a/etherlight.py +++ b/etherlight.py @@ -1,6 +1,7 @@ #! /usr/bin/env python3 +# PYTHON_ARGCOMPLETE_OK -import argparse +import argcomplete, argparse import subprocess from rgbw_colorspace_converter.colors.converters import RGB @@ -33,7 +34,7 @@ PANSEXUAL_PRIDE_SPIRO_DISCO_BALL = [27, 179, 255] def template_pansexual(): - command = "" + command = "echo 0 > /proc/led/led_mode;" for port in range(1, 19): if port < 7: @@ -51,7 +52,7 @@ def template_pansexual(): def template_bisexual(): - command = "" + command = "echo 0 > /proc/led/led_mode;" for port in range(1, 19): if port < 8: @@ -69,7 +70,7 @@ def template_bisexual(): def template_trans(): - command = "" + command = "echo 0 > /proc/led/led_mode;" for port in range(1, 19): if port < 5: @@ -93,7 +94,7 @@ def template_trans(): def template_lesbian(): - command = "" + command = "echo 0 > /proc/led/led_mode;" for port in range(1, 19): if port < 5: @@ -117,7 +118,7 @@ def template_lesbian(): def template_lgbtq(): - command = "" + command = "echo 0 > /proc/led/led_mode;" for port in range(1, 19): if port < 4: @@ -143,7 +144,10 @@ def template_lgbtq(): def get_color_commands(port, red, green, blue, white): - command = "" + if args.color: + command = "echo 0 > /proc/led/led_mode;" + else: + command = "" command += "echo {} r {} > /proc/led/led_color; ".format(port, red * 64) command += "echo {} g {} > /proc/led/led_color; ".format(port, green * 64) command += "echo {} b {} > /proc/led/led_color; ".format(port, blue * 64) @@ -153,7 +157,7 @@ def get_color_commands(port, red, green, blue, white): def flush_leds(): - command = "echo 0 > /proc/led/led_mode" + command = "echo 0 > /proc/led/led_mode;" return command @@ -184,7 +188,7 @@ if __name__ == "__main__": group.add_argument( "-t", "--template", - help="sets a predefined template. Valid options are LESBIAN or LGBTQ", + help="Sets a predefined pride template.", choices=["lesbian", "lgbtq", "trans", "bisexual", "pansexual"], ) group.add_argument( @@ -196,6 +200,7 @@ if __name__ == "__main__": metavar=("PORT", "RED", "GREEN", "BLUE"), ) + argcomplete.autocomplete(parser) args = parser.parse_args() if args.flush: