8000 [TwigBridge] Added support for json format in twig:lint command by lyrixx · Pull Request #10064 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[TwigBridge] Added support for json format in twig:lint command #10064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8000
Next Next commit
[TwigBridge] Cleaned documentation of twig:lint command
  • Loading branch information
lyrixx committed Jan 18, 2014
commit 621f991e1514348b83700c733bdf3bc4dde124d3
13 changes: 6 additions & 7 deletions src/Symfony/Bridge/Twig/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,21 +58,20 @@ protected function configure()
->setDescription('Lints a template and outputs encountered errors')
->addArgument('filename')
->setHelp(<<<EOF
The <info>%command.name%</info> command lints a template and outputs to stdout
The <info>%command.name%</info> command lints a template and outputs to STDOUT
the first encountered syntax error.

You can validate the syntax of a file:

<info>php %command.full_name% filename</info>

The command gets the contents of <comment>filename</comment> and validates its syntax.
Or of a whole directory:

<info>php %command.full_name% dirname</info>

The command finds all twig templates in <comment>dirname</comment> and validates the syntax
of each Twig template.
You can also pass the template contents from STDIN:

<info>cat filename | php %command.full_name%</info>

The command gets the template contents from stdin and validates its syntax.
EOF
)
;
Expand All @@ -86,7 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output)

if (!$filename) {
if (0 !== ftell(STDIN)) {
throw new \RuntimeException("Please provide a filename or pipe template content to stdin.");
throw new \RuntimeException("Please provide a filename or pipe template content to STDIN.");
}

while (!feof(STDIN)) {
Expand Down
5 changes: 2 additions & 3 deletions src/Symfony/Bundle/TwigBundle/Command/LintCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ protected function configure()
$this->getHelp().<<<EOF


<info>php %command.full_name% @AcmeMyBundle</info>
Or all template files in a bundle:

The command finds all twig templates in the <comment>AcmeMyBundle</comment> bundle and validates
the syntax of each Twig template.
<info>php %command.full_name% @AcmeDemoBundle</info>
EOF
)
;
Expand Down
0