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

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42) - Bug fix where resources are not decoded correctly when installing packages [#31](https://git.n64.cc/nosial/ncc/-/issues/42)
- Fixed issue where dependency conflicts are thrown even when `--reinstall` is used - Fixed issue where dependency conflicts are thrown even when `--reinstall` is used
- Properly implemented `composer.enable_internal_composer` so that warnings regarding improper configuration values are not thrown - Properly implemented `composer.enable_internal_composer` so that warnings regarding improper configuration values are not thrown
- Minor improvements to the CLI interface including fixing `--version`
### Changed ### Changed

View file

@ -49,8 +49,10 @@ namespace ncc\CLI;
$basic_ascii = true; $basic_ascii = true;
} }
// TODO: Make copyright not hard-coded. Console::out(Functions::getBanner(
print(Functions::getBanner(NCC_VERSION_BRANCH . ' ' . NCC_VERSION_NUMBER, 'Copyright (c) 2022-2022 Nosial', $basic_ascii) . PHP_EOL); 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('Usage: ncc COMMAND [options]');
Console::out('Alternative Usage: ncc.php --ncc-cli=COMMAND [options]' . PHP_EOL); 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'); 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 try
{ {
switch(strtolower(self::$args['ncc-cli'])) switch(strtolower(self::$args['ncc-cli']))
@ -162,7 +168,7 @@
break; break;
case 'version': case 'version':
Console::out(sprintf('NCC version %s (%s)', NCC_VERSION_NUMBER, NCC_VERSION_BRANCH)); self::displayVersion();
break; break;
case '1': 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 * @return array
*/ */