Mercurial > piecrust2
diff piecrust/app.py @ 1182:31e8ee0bf5b2
prepare: Refactor scaffolding code.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 21 May 2020 22:08:23 -0700 |
parents | c4cf3cfe2726 |
children |
line wrap: on
line diff
--- a/piecrust/app.py Thu May 21 22:05:30 2020 -0700 +++ b/piecrust/app.py Thu May 21 22:08:23 2020 -0700 @@ -224,6 +224,19 @@ return pub return None + def getCommand(self, command_name): + for cmd in self.plugin_loader.getCommands(): + if cmd.name == command_name: + return cmd + return None + + def getCommandExtensions(self, command_name, supported_only=True): + extensions = self.plugin_loader.getCommandExtensions() + for e in extensions: + if (e.command_name == command_name and + (not supported_only or e.supports(self))): + yield e + def getPage(self, source, content_item): cache_key = '%s@%s' % (source.name, content_item.spec) return self.env.page_repository.get(