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

/*
|--------------------------------------------------------------------------
| Basic CLI actions for PHP Mini Framework
|--------------------------------------------------------------------------
*/

require __DIR__.'/vendor/autoload.php';

use App\Core\CLI;

$cli = new CLI();

//print_r($argc); // number or arguments
//print_r($argv);
$command = $argv[1];

// Create a certain file type
if (strpos($command, 'new:') !== false && isset($argv[2])) {
    $commandParts = explode(':', $command);
    $makeThis = $commandParts[1];

    // Create a controller
    if ($makeThis == 'controller') {
        $controllerName = $argv[2];
        $cli->createController($controllerName);
    }

    // Create a model
    if ($makeThis == 'model') {
        $modelName = $argv[2];
        $cli->createModel($modelName);
    }

} else {
    print_r("Not a valid Mini Framework command.");
}

echo "\n";
die();