Skip to content

Changes

Summary

  1. contrib/sim-rest-client: don't crash without args (details)
Commit 977d65e322808af92c91454b374f9a8b11790166 by Oliver Smith
contrib/sim-rest-client: don't crash without args

When running without an argument, let argparse print a nice usage error:

  $ ./sim-rest-client.py
  usage: sim-rest-client.py [-h] [-H HOST] [-p PORT] [-v] [-n SLOT_NR] {auth,info} ...
  sim-rest-client.py: error: the following arguments are required: {auth,info}

Instead of:

  $ ./sim-rest-client.py
  Traceback (most recent call last):
    File "/usr/share/pysim/contrib/./sim-rest-client.py", line 185, in <module>
      main(sys.argv)
    File "/usr/share/pysim/contrib/./sim-rest-client.py", line 181, in main
      args.func(args)
      ^^^^^^^^^
  AttributeError: 'Namespace' object has no attribute 'func'

Change-Id: I92998d9b94dcfb9dcfc3da161fe5d8f45f242b78
The file was modified contrib/sim-rest-client.py