#!/usr/bin/env php
<?php
use boru\dhcli\dhCLI;
use boru\dhcli\Option;
use boru\dhfw\AppRouter;
use boru\dhfw\DHFW;
use boru\dhfw\FWCli;
use boru\dhfw\util\FindDir;
use boru\dhfw\util\FWSetup;
use boru\dhutils\filesys\File;

if(isset($GLOBALS['_composer_bin_dir'])) {
    $rootDir = realpath($GLOBALS['_composer_bin_dir']."/../../");
} else {
    $dir = __DIR__;
    $myParent = "/vendor/boru/dhfw/bin";
    if(substr($dir,-strlen($myParent))==$myParent) {
        //included as a dependency
        $rootDir = realpath($dir."/../../../../");
    } else {
        //in the dhfw repository
        $rootDir = realpath($dir."/../");
    }
}
require $rootDir."/init.php";

$file = File::fromInput($argv[0],false);
array_shift($argv);

FWCli::launch($argv,$file->path());
