コード例 #1
0
ファイル: Application.php プロジェクト: nochso/writeme
 /**
  * @return \nochso\WriteMe\Document
  */
 public function interactiveTemplateToDocument()
 {
     $template = new InteractiveTemplate($this->stdio, $this->placeholders);
     $availableTemplates = $template->getAvailableTemplates();
     $templateIndex = $this->stdio->chooseFromList($availableTemplates, 'Choose an interactive template', true);
     $templateFilepath = $availableTemplates[$templateIndex];
     $filepath = $this->stdio->ask('Filepath of your new customized template', 'WRITEME.md');
     $targetPath = $this->stdio->ask('Filepath to final result file', 'README.md');
     $generatedContent = $template->render($templateFilepath);
     $doc = new Document($generatedContent, $filepath);
     $doc->setFrontmatter($template->getFrontmatter());
     $doc->getFrontmatter()->set('target', $targetPath);
     return $doc;
 }