From: Moritz Schlarb <schlarbm@uni-mainz.de>
Date: Wed, 16 May 2018 14:47:00 +0200
Subject: Use argparse in searpc-codegen for basic --help

---
 lib/searpc-codegen.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lib/searpc-codegen.py b/lib/searpc-codegen.py
index dbbf8c9..7fc1718 100644
--- a/lib/searpc-codegen.py
+++ b/lib/searpc-codegen.py
@@ -176,11 +176,16 @@ def gen_signature_list():
             write_file(f, generate_signature(item[0], item[1]))
 
 if __name__ == "__main__":
+    import argparse
+    parser = argparse.ArgumentParser(description='Generate function signatures and marshals for using Searpc')
+    parser.add_argument('rpc_mod_file', nargs='?', help='the RPC module file name (default: rpc_table)')
+    args = parser.parse_args()
+
     sys.path.append(os.getcwd())
 
     # load function table
-    if len(sys.argv) == 2:
-        abspath = os.path.abspath(sys.argv[1])
+    if args.rpc_mod_file:
+        abspath = os.path.abspath(args.rpc_mod_file)
         with open(abspath, 'r') as fp:
             exec(fp.read())
         print("loaded func_table from %s" % abspath)
