diff options
author | Zach Prezkuta <fermion@gmx.com> | 2013-01-11 09:42:07 -0700 |
---|---|---|
committer | Zach Prezkuta <fermion@gmx.com> | 2013-01-11 09:42:07 -0700 |
commit | 1c01cba21ebebe7d1b2586c2ef355e930ae3e722 (patch) | |
tree | 202847e81813dbd04acf41fbc46b80505852818c /mods/friendica-to-smarty-tpl.py | |
parent | 89423844bbcfb8f62dd1672dd103ce6e8018a2e2 (diff) | |
download | volse-hubzilla-1c01cba21ebebe7d1b2586c2ef355e930ae3e722.tar.gz volse-hubzilla-1c01cba21ebebe7d1b2586c2ef355e930ae3e722.tar.bz2 volse-hubzilla-1c01cba21ebebe7d1b2586c2ef355e930ae3e722.zip |
automatic, command-line conversion
Diffstat (limited to 'mods/friendica-to-smarty-tpl.py')
-rwxr-xr-x | mods/friendica-to-smarty-tpl.py | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/mods/friendica-to-smarty-tpl.py b/mods/friendica-to-smarty-tpl.py index ff1a102a4..369b8ea9a 100755 --- a/mods/friendica-to-smarty-tpl.py +++ b/mods/friendica-to-smarty-tpl.py @@ -1,10 +1,11 @@ #!/usr/bin/python # # Script to convert Friendica internal template files into Smarty template files -# Copyright 2012 Zach Prezkuta +# Copyright 2013 Zach Prezkuta # Licensed under GPL v3 import os, re, string +import sys, getopt ldelim = '{{' rdelim = '}}' @@ -170,7 +171,37 @@ def convert(filename, tofilename, php_tpl): tofilename.write(newline) -path = raw_input('Path to template folder to convert: ') +def help(pname): + print "\nUsage:" + print "\t" + pname + " -h\n\n\t\t\tShow this help screen\n" + print "\t" + pname + " -p directory\n\n\t\t\tConvert all .tpl files in directory to\n\t\t\tSmarty templates in directory/smarty3/\n" + print "\t" + pname + "\n\n\t\t\tInteractive mode\n" + + + + +# +# Main script +# + +path = '' + +try: + opts, args = getopt.getopt(sys.argv[1:], "hp:") + for opt, arg in opts: + if opt == '-h': + help(sys.argv[0]) + sys.exit() + elif opt == '-p': + path = arg +except getopt.GetoptError: + help(sys.argv[0]) + sys.exit(2) + + +if path == '': + path = raw_input('Path to template folder to convert: ') + if path[-1:] != '/': path = path + '/' |