1.0.0 Alpha Release #59

Merged
netkas merged 213 commits from v1.0.0_alpha into master 2023-01-29 23:27:58 +00:00
Showing only changes of commit f08ecb7947 - Show all commits

View file

@ -12,6 +12,7 @@
use ncc\ncc; use ncc\ncc;
use ncc\Utilities\Console; use ncc\Utilities\Console;
use ncc\Utilities\Resolver; use ncc\Utilities\Resolver;
use ncc\Utilities\RuntimeCache;
class Main class Main
{ {
@ -24,7 +25,7 @@
* @var string|null * @var string|null
*/ */
private static $log_level; private static $log_level;
/** /**
* Executes the main CLI process * Executes the main CLI process
* *
@ -51,8 +52,8 @@
Console::outException('Cannot initialize NCC due to a runtime error.', $e, 1); Console::outException('Cannot initialize NCC due to a runtime error.', $e, 1);
} }
// Define CLI stuff
define('NCC_CLI_MODE', 1); define('NCC_CLI_MODE', 1);
register_shutdown_function('ncc\CLI\Main::shutdown');
if(isset(self::$args['l']) || isset(self::$args['log-level'])) if(isset(self::$args['l']) || isset(self::$args['log-level']))
{ {
@ -82,13 +83,14 @@
if(Resolver::checkLogLevel(self::$log_level, LogLevel::Debug)) if(Resolver::checkLogLevel(self::$log_level, LogLevel::Debug))
{ {
Console::outDebug('Debug logging enabled'); Console::outDebug('Debug logging enabled');
Console::outDebug(sprintf('consts: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES))); /** @noinspection PhpUnhandledExceptionInspection */
Console::outDebug(sprintf('const: %s', json_encode(ncc::getConstants(), JSON_UNESCAPED_SLASHES)));
Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES))); Console::outDebug(sprintf('args: %s', json_encode(self::$args, JSON_UNESCAPED_SLASHES)));
} }
if(in_array(NccBuildFlags::Unstable, NCC_VERSION_FLAGS)) if(in_array(NccBuildFlags::Unstable, NCC_VERSION_FLAGS))
{ {
//Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected'); Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected');
} }
try try
@ -152,4 +154,13 @@
return self::$log_level; return self::$log_level;
} }
/**
* @return void
*/
public static function shutdown()
{
Console::outDebug('clearing cache');
RuntimeCache::clearCache();
}
} }