comparison piecrust/commands/builtin/util.py @ 60:6e60e0fef2be

Add `import` command, Jekyll importer.
author Ludovic Chabant <ludovic@chabant.com>
date Tue, 26 Aug 2014 23:20:48 -0700
parents 5d9d44bfc54d
children 28958565a17b
comparison
equal deleted inserted replaced
59:e3e3de44377c 60:6e60e0fef2be
112 f.write('---\n') 112 f.write('---\n')
113 f.write('title: %s\n' % 'Unknown title') 113 f.write('title: %s\n' % 'Unknown title')
114 f.write('---\n') 114 f.write('---\n')
115 f.write("This is a new page!\n") 115 f.write("This is a new page!\n")
116 116
117
118 class ImportCommand(ChefCommand):
119 def __init__(self):
120 super(ImportCommand, self).__init__()
121 self.name = 'import'
122 self.description = "Imports content from another CMS into PieCrust."
123
124 def setupParser(self, parser, app):
125 subparsers = parser.add_subparsers()
126 for i in app.plugin_loader.getImporters():
127 p = subparsers.add_parser(i.name, help=i.description)
128 i.setupParser(p, app)
129 p.set_defaults(sub_func=i.checkedImportWebsite)
130
131 def run(self, ctx):
132 ctx.args.sub_func(ctx)
133