changeset 83:78139c3cecfa

CLI
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 15 Dec 2013 12:38:24 -0800
parents 8596a1d97740
children 95820b36d7e3
files decoupage/templates.py
diffstat 1 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/templates.py	Fri Nov 29 20:45:20 2013 -0800
+++ b/decoupage/templates.py	Sun Dec 15 12:38:24 2013 -0800
@@ -1,5 +1,9 @@
 #!/usr/bin/env python
 
+"""
+functionality related to templates
+"""
+
 import os
 import sys
 from optparse import OptionParser
@@ -17,18 +21,28 @@
         if os.path.isdir(template_dir):
             template_dirs.add(template_dir)
     return template_dirs
-        
+
+
 def templates():
     templates = []
     for directory in template_dirs():
-        templates.extend([os.path.join(directory, filename) 
+        templates.extend([os.path.join(directory, filename)
                           for filename in os.listdir(directory)
                           if filename.endswith('.html')])
     return templates
 
+
 def main(args=sys.argv[1:]):
+
+    # comman line option parser
+    description = 'list available templates'
+    parser = OptionParser(description=description)
+    options, args = parser.parse_args(args)
+
+    # list templates
     for template in templates():
         print template
 
+
 if __name__ == '__main__':
     main()