Skip to content

Commit

Permalink
Added simply getopt support for tundra2-txml-convertes
Browse files Browse the repository at this point in the history
now -i|--input= and -o|--output= params are accepted
  • Loading branch information
vatjjar authored and Jukka Jylänki committed Aug 20, 2011
1 parent 857196d commit 9007b81
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions tools/tundra2-txml-converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,29 @@ def getNewValue(self):

if __name__ == "__main__":

fileName = "putFileNameHere.txml"
newFileName = fileName[:fileName.index(".txml")] + "_.txml"
try:
import getopt
try:
opts, args = getopt.getopt(sys.argv[1:], "i:o:", ["input=", "output="])
except getopt.GetoptError, err:
# print help information and exit:
print str(err)
print "Usage: tundra2-txml-converter.py [-i|--input=inputTXML] [-o|--output=outputTXML]"
sys.exit(2)
# Set defaults first:
fileName = "putFileNameHere.txml"
newFileName = fileName[:fileName.index(".txml")] + "_.txml"
for o, a in opts:
if o in ("-i", "--input"):
fileName = a
elif o in ("-o", "--output"):
newFileName = a
except ImportError:
fileName = "putFileNameHere.txml"
newFileName = fileName[:fileName.index(".txml")] + "_.txml"

c = getFileContent(fileName)
if c == None: sys.exit(2)
lines = c.splitlines(True)

parentName = "GeneratedGrandParentEntity"
Expand Down

0 comments on commit 9007b81

Please sign in to comment.