コード例 #1
0
ファイル: make-docs.php プロジェクト: 4aficiona2/cli
/**
 * Writes documentation to file
 *
 * @param [string]         $namespace Namespace to which the doc file will pertain
 * @param [array <string>] $docs      Documentation to add to file
 * @return [boolean] True if write was successful
 */
function writeDocFile($namespace, $docs)
{
    $filename = TERMINUS_ROOT . '/docs/' . str_replace(array('Terminus\\', '\\'), array('', '/'), $namespace) . '.md';
    $rendered_doc = Utils\twigRender('doc.twig', $docs, array('namespace' => $namespace));
    file_put_contents($filename, $rendered_doc);
    return true;
}
コード例 #2
0
ファイル: HelpCommand.php プロジェクト: serundeputy/cli
 /**
  * Takes a command to get help for and processes its internal documentation
  *
  * @param CompositeCommand $command The command to offer help for
  * @return int
  */
 private function showHelp(CompositeCommand $command)
 {
     $out = $this->getMarkdown($command);
     $exit_status = 0;
     if (Terminus::getConfig('format') == 'json') {
         $this->output()->outputRecord($out);
     } else {
         $rendered_help = Utils\twigRender('man.twig', $out, array('recursive' => $this->recursive));
         if (Terminus::getConfig('format') == 'normal') {
             $exit_status = $this->passThroughPager($rendered_help);
         } else {
             $this->output()->outputRecord($rendered_help);
         }
     }
     return $exit_status;
 }
コード例 #3
0
ファイル: test-utils.php プロジェクト: RazzYoshi/cli
 public function testTwigRender()
 {
     $template_name = 'man.twig';
     $rendered_template = Utils\twigRender($template_name, [], []);
     $this->assertTrue(strpos($rendered_template, '##NAME') === 0);
 }