#!/usr/bin/env php
<?php
/**
 * Setup composer-based autoloading for a Zend Framework module.
 *
 * Usage:
 *
 *     autoload-module-via-composer [help|--help|-h] [--composer|-c <composer path>] [--type|-t <psr0|psr4>] modulename
 *
 * @license   http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause
 * @copyright Copyright (c) 2016 Zend Technologies USA Inc. (http://www.zend.com)
 */

namespace ZF\ComposerAutoloading;

// Setup/verify autoloading
if (file_exists($a = __DIR__ . '/../../../autoload.php')) {
    require $a;
} elseif (file_exists($a = __DIR__ . '/../vendor/autoload.php')) {
    require $a;
} else {
    fwrite(STDERR, 'Cannot locate autoloader; please run "composer install"' . PHP_EOL);
    exit(1);
}

$command = new Command(realpath(getcwd()));
$status = $command($argv);
exit($status);
