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

if ( ! function_exists('_dir'))
{
	/**
	 * Joins paths together. Variadic to take an
	 * arbitrary number of arguments
	 *
	 * @return string
	 */
	function _dir()
	{
		return implode(DIRECTORY_SEPARATOR, func_get_args());
	}
}

$_SERVER['HTTP_HOST'] = 'localhost';

// Define base directories
$APP_DIR = __DIR__ . '/app/';
$SRC_DIR = __DIR__ . '/src/';
$CONF_DIR = realpath("${APP_DIR}/config/");

// Set up autoloader for third-party dependencies
require_once realpath(__DIR__ . '/vendor/autoload.php');

// Unset 'constants'
unset($APP_DIR);
unset($SRC_DIR);
unset($CONF_DIR);

// ---------------------------------------------------------------------------------------------------------------------
// Start console script
// ---------------------------------------------------------------------------------------------------------------------
$console = new \ConsoleKit\Console([
	'clear-cache' => '\Aviat\AnimeClient\Command\ClearCache',
	'sync-lists' => '\Aviat\AnimeClient\Command\SyncKitsuWithMal'
]);

$console->run();