Minor improvements to the CLI interface including fixing --version
This commit is contained in:
parent
da9e615418
commit
6381ec509c
3 changed files with 17 additions and 3 deletions
|
@ -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)
|
||||
- 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
|
||||
- Minor improvements to the CLI interface including fixing `--version`
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue