#!/usr/bin/env php
<?php

use Inhere\Console\IO\Input;
use Inhere\Console\IO\Output;
use Inhere\Kite\Console\CliApplication;
use Inhere\Kite\Console\Command\DocCommand;

require dirname(__DIR__) . '/app/boot.php';

// app config
$conf = [
    'rootPath' => BASE_PATH,
];

// create input
$in = new Input();
$in->setCommand(DocCommand::getName());

// create output
$out = new Output();

// create an application
$app = new CliApplication($conf, $in, $out);

// man command
$htc = new DocCommand($in, $out);

try {
    $htc->setApp($app);
    $htc->run($in->getFlags());
} catch (Throwable $e) {
    $app->getErrorHandler()->handle($e);
}
