tidy tool for Template Toolkit
Revision | 9d00c1bfa7eb43f97f69bc8c12e49b55f1627ae0 (tree) |
---|---|
Zeit | 2015-07-08 20:27:47 |
Autor | hylom <hylom@user...> |
Commiter | hylom |
add '--directives' option for debug
@@ -150,9 +150,18 @@ def main(): | ||
150 | 150 | parser = argparse.ArgumentParser('tidy tool for template toolkit') |
151 | 151 | parser.add_argument('file', type=file) |
152 | 152 | parser.add_argument('--unindent', '-u', action='store_true') |
153 | + parser.add_argument('--directives', action='store_true') | |
153 | 154 | |
154 | 155 | args = parser.parse_args() |
155 | 156 | |
157 | + # when '--directives' is given, extract directives | |
158 | + # this is for debug | |
159 | + if args.directives: | |
160 | + indenter = Indenter() | |
161 | + r = indenter.extract_directives(args.file) | |
162 | + print "\n".join(r) | |
163 | + return | |
164 | + | |
156 | 165 | # when '--unindent' is given, do unindent |
157 | 166 | if args.unindent: |
158 | 167 | ret = unindent(args.file) |