Skip to content

Commit

Permalink
Merge pull request #58 from robertbreker/fix-json-error-encapsulation
Browse files Browse the repository at this point in the history
Fix json error encapsulation
  • Loading branch information
Robert Breker committed Oct 5, 2015
2 parents 4e0f350 + bc2fce0 commit 30a6b96
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions generator/src/python.ml
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,11 @@ let commandline_parse env i m =
Line (sprintf "\"\"\"%s\"\"\"" m.Method.description);
] @ [
Line "# in --json mode we don't have any other arguments";
Line "if '--json' in sys.argv:";
Line "if ('--json' in sys.argv or '-j' in sys.argv):";
Block [
Line "return json.loads(sys.stdin.readline(),)";
Line "jsondict = json.loads(sys.stdin.readline(),)";
Line "jsondict['json'] = True";
Line "return jsondict";
];
Line (sprintf "parser = argparse.ArgumentParser(description='%s')" m.Method.description);
Line "parser.add_argument('-j', '--json', action='store_const', const=True, default=False, help='Read json from stdin, print json to stdout', required=False)";
Expand Down

0 comments on commit 30a6b96

Please sign in to comment.