Skip to content

Commit

Permalink
Use argparse in searpc-codegen for basic --help
Browse files Browse the repository at this point in the history
  • Loading branch information
moschlar committed Sep 11, 2018
1 parent 2021fe4 commit 4e9ed72
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/searpc-codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4e9ed72

Please sign in to comment.