aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Goger <klaus.goger@theobroma-systems.com>2023-08-04 11:42:52 +0200
committerKlaus Goger <klaus.goger@theobroma-systems.com>2023-08-04 13:30:36 +0200
commitdcd2a591f06e0899732ad3ea526b67e54d6b2b66 (patch)
treeec5b8144e04f8b42a82cc1cc396f18bd154d70e1
parentd3646dfa98e5da4f39494ae8df7f610116b3b650 (diff)
usb-control: print usage if called without argument
We should really use argparse, but for now improve the usability by printing the usage help when there is no command provided. Signed-off-by: Klaus Goger <klaus.goger@theobroma-systems.com>
-rw-r--r--usb-control/command_processor.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/usb-control/command_processor.py b/usb-control/command_processor.py
index f03843b..3ddfc3e 100644
--- a/usb-control/command_processor.py
+++ b/usb-control/command_processor.py
@@ -85,6 +85,11 @@ class CommandProcessor:
print("No devices found!")
sys.exit(2)
+ # If no command is provided print usage and exit
+ if not self.command_list:
+ self.print_helpstring()
+ sys.exit(2)
+
# List devices if required
if 'list' in self.command_list:
do_list(devs)