twigc/bin/compile
dana 9cbe7e75f9 Significantly rework application: 0.3.0
- Get rid of Symfony Console application/command/input components

  These were causing me serious problems — not least of all was the fact that
  the Console argument parser chokes on command lines lke `twigc -j - foo.twig`.
  I am not happy with the way i've structured this, but i just needed to get it
  *done*, so here we are. If someone has any advice on to how to make this nicer
  (maybe break it up into different classes, &c.), i would be appreciative

- Add GetOpt.php for argument parsing and usage-help printing

  The usage help is really ugly, tbh. But whatever

- Support multiple input data sources at once

- Add `-E` short option for `--env`

- Display an error when `-E` is used without the appropriate `variables_order`
  configuration in place

- Add shell (`sh`) auto-escape method

- Simplify/eliminate a lot of code (handling of version numbers, validation, &c.)

- Change a lot of white space and formatting stuff (RIP `blame`)
2018-06-02 01:58:59 -05:00

27 lines
525 B
PHP
Executable file

#!/usr/bin/env php
<?php
/**
* This file is part of twigc.
*
* @author dana <dana@dana.is>
* @license MIT
*/
require_once __DIR__ . '/../src/bootstrap.php';
use Symfony\Component\Console\Output\ConsoleOutput;
use Dana\Twigc\PharCompiler;
$verbose = false;
$verboseArgs = ['v', 'vv', 'vvv', 'verbose', 'debug'];
foreach ( $argv as $arg ) {
if ( in_array(ltrim($arg, '-'), $verboseArgs, true) ) {
$verbose = true;
break;
}
}
(new PharCompiler(new ConsoleOutput(), $verbose))->compile('twigc.phar');