Skip to content

Commit

Permalink
added output file recording, argv handling and usage()
Browse files Browse the repository at this point in the history
  • Loading branch information
blackthorne committed Apr 8, 2010
1 parent eaca3e0 commit dba961b
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions w2pymt.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,21 @@ def gen_code(self):

def __str__(self):
return self.gen_code()


def usage():
print 'ERROR: missing or wrongly defined parameters'
print 'usage:'
print '\t' + sys.argv[0] + " <yaml_model> <db_output_file>\n"
exit()

def main():
print 'Loading model...'
model = Model('models/yaml/test.yml')
print model

if len(sys.argv) == 3:
model = Model(sys.argv[1])
file = open(sys.argv[2],'w')
file.write(model.gen_code())
file.close()
else:
usage()
if __name__ == '__main__':
main()

0 comments on commit dba961b

Please sign in to comment.