# HG changeset patch # User Jeff Hammel # Date 1295057845 28800 # Node ID 613e9c19a98c258f4f98e9e98fdf3a12c82cb962 # Parent 697568ba4a2254d94f5dcab4880c952bd99780f5 add a --list-templates command diff -r 697568ba4a22 -r 613e9c19a98c makeitso/makeitso.py --- a/makeitso/makeitso.py Fri Jan 14 17:55:08 2011 -0800 +++ b/makeitso/makeitso.py Fri Jan 14 18:17:25 2011 -0800 @@ -443,9 +443,25 @@ parser.add_option('--variables', dest='variables', action='store_true', default=False, help='print the variables in a template') + entry_points = get_entry_points() + if entry_points: + parser.add_option('--list-templates', dest='list_templates', + action='store_true', default=False, + help="list installed MakeItSo! templates") + options, args = parser.parse_args(args) + # list the templates + if entry_points and options.list_templates: + for key in sorted(entry_points.keys()): + template_class = entry_points[key] + description = getattr(template_class, 'description', '') + description = description or getattr(template_class, '__doc__', '') + description = description.strip() + print key + ': ' + description + return + # print the variables for the templates if options.variables: