Minor improvements to the CLI interface including fixing --version

This commit is contained in:
Netkas 2023-02-07 16:07:52 -05:00
parent da9e615418
commit 6381ec509c
3 changed files with 17 additions and 3 deletions

View file

@ -49,8 +49,10 @@ namespace ncc\CLI;
$basic_ascii = true;
}
// TODO: Make copyright not hard-coded.
print(Functions::getBanner(NCC_VERSION_BRANCH . ' ' . NCC_VERSION_NUMBER, 'Copyright (c) 2022-2022 Nosial', $basic_ascii) . PHP_EOL);
Console::out(Functions::getBanner(
sprintf('%s %s', NCC_VERSION_BRANCH, NCC_VERSION_NUMBER),
sprintf('Copyright (c) 2022-%s Nosial', date('Y')), $basic_ascii)
);
Console::out('Usage: ncc COMMAND [options]');
Console::out('Alternative Usage: ncc.php --ncc-cli=COMMAND [options]' . PHP_EOL);

View file

@ -125,6 +125,12 @@
Console::outWarning('This is an unstable build of NCC, expect some features to not work as expected');
}
if(isset(self::$args['version']))
{
self::displayVersion();
exit(0);
}
try
{
switch(strtolower(self::$args['ncc-cli']))
@ -162,7 +168,7 @@
break;
case 'version':
Console::out(sprintf('NCC version %s (%s)', NCC_VERSION_NUMBER, NCC_VERSION_BRANCH));
self::displayVersion();
break;
case '1':
@ -181,6 +187,11 @@
}
}
private static function displayVersion()
{
Console::out(sprintf('NCC version %s (%s)', NCC_VERSION_NUMBER, NCC_VERSION_BRANCH));
}
/**
* @return array
*/