#!/usr/bin/php
<?php

if (php_sapi_name() !== 'cli') {
    exit;
}

require_once __DIR__ . "/vendor/autoload.php";

use App\Core\Application;
use App\Core\Config;
use App\Core\Command_Container;
use App\IO\Output;
use App\IO\Input;
use App\IO\Themes\Alt_Printer;

// Get any user set config values
$config = Config::load(__DIR__ . "/App/config.ini")->get();
$command_container = new Command_Container($config, $argv);

$app = Application::load($command_container);


$app->set('hello-world', function () {
    $out = new Output(new Alt_Printer);
    $out->message('Hello World');

    if (Input::affirm("Would you like to continue? Y/n")) {
        Output::success('CONTINUE');
    }

    if (Input::warnAffirm('This cannot be undone are you sure? Yes/No', ['Yes', 'No'])) {
        Output::success('warn continue');
    }
});

$app->set('help', function () {
    Output::file(__DIR__ . "/App/Output_Files/test.txt", ['version' => '1.2.3-beta']);
});

$app->set('world', 'App\Commands\Hello\Default_Handler@world');

$app->run();
