You are here

protected function LintCommand::configure in Twig Tweak 3.1.x

Same name and namespace in other branches
  1. 3.x src/Command/LintCommand.php \Drupal\twig_tweak\Command\LintCommand::configure()
1 call to LintCommand::configure()
ValidateCommand::configure in src/Command/ValidateCommand.php
1 method overrides LintCommand::configure()
ValidateCommand::configure in src/Command/ValidateCommand.php

File

src/Command/LintCommand.php, line 51

Class

LintCommand
Command that will validate your template syntax and output encountered errors.

Namespace

Drupal\twig_tweak\Command

Code

protected function configure() {
  $this
    ->setDescription('Lints a template and outputs encountered errors')
    ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format', 'txt')
    ->addOption('show-deprecations', null, InputOption::VALUE_NONE, 'Show deprecations as errors')
    ->addArgument('filename', InputArgument::IS_ARRAY, 'A file, a directory or "-" for reading from STDIN')
    ->setHelp(<<<'EOF'
The <info>%command.name%</info> command lints a template and outputs to STDOUT
the first encountered syntax error.

You can validate the syntax of contents passed from STDIN:

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

Or the syntax of a file:

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

Or of a whole directory:

  <info>php %command.full_name% dirname</info>
  <info>php %command.full_name% dirname --format=json</info>

EOF
);
}