#!/usr/bin/env php
<?php
declare(strict_types=1);

use Which\{Application};

/**
 * Application entry point.
 */
function main() {
  @cli_set_process_title('Which.php');
  exit((new Application)->run());
}

// Start the application.
try {
  $fileInfo = new SplFileInfo(__DIR__.'/../../../autoload.php');
  require_once $fileInfo->isFile() ? $fileInfo->getPathname() : __DIR__.'/../vendor/autoload.php';
  main();
}

catch (\Throwable $error) {
  echo $error, PHP_EOL;
  exit(2);
}
