def _serve(self, args=None): os.chdir(self.mkdocs_dir) cmd = 'mkdocs' cmd_args = [] if not args: cmd_args = ['serve'] else: cmd_args.extend(args) run_cmd(cmd=cmd, cmd_args=cmd_args)
def run(self, cmd=None, expand=True): """ Run a command on the attribute name. :param cmd: a command, command string or template. If no "{}" or "{attr}" is in `cmd`, the content of the "path" attribute is appended to the end of it; otherwise, all occurrences of "{}" and "{attr}" are replaced with corresponding attribute contents. "{}" is expanded into the content of the path attribute. """ attr = self.get_attr(self.default_attrname) if cmd is None: run_cmd(cmd=attr.content) else: if self.is_expandable(cmd): cmd_str = self.expand_str(cmd) else: cmd_str = '%s %s' % (cmd, attr.content) run_cmd(cmd_str)
def run(self, cmd=None): if cmd is None: run_cmd(cmd=self.elem.content) else: run_cmd(cmd=cmd, cmd_args=[self.elem.content])