Neither open code the access to the sys.argv[] detail nor indices of
positional arguments. Use the argparse(3) Python module instead, which
transparently handles presence checks and provides a help text.
## along with this program; if not, see <http://www.gnu.org/licenses/>.
##
+import argparse
import os
import sys
import re
return data # keep binary data
if __name__ == "__main__":
- if len(sys.argv) != 2:
- print("sigrok-fwextract-kingst-la2016 <programfile>")
- sys.exit()
+ parser = argparse.ArgumentParser(description = "KingstVIS firmware extraction")
+ parser.add_argument('executable', help = "KingstVIS executable file")
+ options = parser.parse_args()
+ exe_fn = options.executable
- res = qt_resources(sys.argv[1])
+ res = qt_resources(exe_fn)
writer = res_writer(res)