Various changes

This commit is contained in:
Netkas 2022-05-09 18:02:28 +01:00
parent cb8adf0e30
commit 0e71eb509c
4 changed files with 32 additions and 22 deletions

View file

@ -3,7 +3,6 @@
namespace ncc\CLI; namespace ncc\CLI;
use ncc\Objects\CliHelpSection; use ncc\Objects\CliHelpSection;
use ncc\Utilities\Resolver;
class HelpMenu class HelpMenu
{ {
@ -15,7 +14,8 @@
*/ */
public static function start($argv) public static function start($argv)
{ {
print('Usage: ncc [options] COMMAND' . PHP_EOL . PHP_EOL); print('Usage: ncc COMMAND [options]' . PHP_EOL);
print('Alternative Usage: ncc.php --ncc-cli=COMMAND [options]' . PHP_EOL . PHP_EOL);
print('Nosial Code Compiler / Project Toolkit' . PHP_EOL . PHP_EOL); print('Nosial Code Compiler / Project Toolkit' . PHP_EOL . PHP_EOL);
self::displayMainOptions(); self::displayMainOptions();
@ -38,9 +38,7 @@
new CliHelpSection(['-l', '--log-level={debug|info|warn|error|fatal}'], 'Set the logging level', 'info'), new CliHelpSection(['-l', '--log-level={debug|info|warn|error|fatal}'], 'Set the logging level', 'info'),
new CliHelpSection(['--basic-ascii'], 'Uses basic ascii characters'), new CliHelpSection(['--basic-ascii'], 'Uses basic ascii characters'),
new CliHelpSection(['--no-color'], 'Omits the use of colors'), new CliHelpSection(['--no-color'], 'Omits the use of colors'),
new CliHelpSection(['--no-banner'], 'Omits displaying the NCC ascii banner'), new CliHelpSection(['--no-banner'], 'Omits displaying the NCC ascii banner')
new CliHelpSection(['--no-ui'], 'Omits displaying a user-interface for wizards/dialogs'),
new CliHelpSection(['--require-scope={user|system}'], 'Enforces the requirement of a access scope', 'user'),
]; ];
$options_padding = \ncc\Utilities\Functions::detectParametersPadding($options) + 4; $options_padding = \ncc\Utilities\Functions::detectParametersPadding($options) + 4;

View file

@ -18,9 +18,21 @@
if(isset($args['ncc-cli'])) if(isset($args['ncc-cli']))
{ {
$banner = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'banner_extended'); // Initialize NCC
\ncc\ncc::initialize();
$banner_version = 'Master 1.0.0'; if(isset($args['no-banner']) == false)
{
if(isset($args['basic-ascii']))
{
$banner = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'banner_basic');
}
else
{
$banner = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'banner_extended');
}
$banner_version = NCC_VERSION_BRANCH . ' ' . NCC_VERSION_NUMBER;
$banner_version = str_pad($banner_version, 21); $banner_version = str_pad($banner_version, 21);
$banner_copyright = 'Copyright (c) 2022-2022 Nosial'; $banner_copyright = 'Copyright (c) 2022-2022 Nosial';
@ -30,10 +42,16 @@
$banner = str_ireplace('%B', $banner_copyright, $banner); $banner = str_ireplace('%B', $banner_copyright, $banner);
print($banner . PHP_EOL); print($banner . PHP_EOL);
}
switch(strtolower($args['ncc-cli'])) switch(strtolower($args['ncc-cli']))
{ {
default: default:
print('Unknown command ' . strtolower($args['ncc-cli']) . PHP_EOL);
exit(1);
case '1':
case 'help': case 'help':
HelpMenu::start($argv); HelpMenu::start($argv);
exit(0); exit(0);

View file

@ -1,6 +0,0 @@
{
"version": "1.0.0",
"branch": "master",
"flags": ["UNSTABLE"],
"update_source": null
}

View file

@ -42,7 +42,7 @@
try try
{ {
self::$VersionInformation = \ncc\Objects\NccVersionInformation::fromArray(\ncc\Utilities\Functions::loadJsonFile(__DIR__ . DIRECTORY_SEPARATOR . 'version.json')); self::$VersionInformation = \ncc\Objects\NccVersionInformation::fromArray(\ncc\Utilities\Functions::loadJsonFile(__DIR__ . DIRECTORY_SEPARATOR . 'version.json', \ncc\Utilities\Functions::FORCE_ARRAY));
} }
catch(\ncc\Exceptions\MalformedJsonException $e) catch(\ncc\Exceptions\MalformedJsonException $e)
{ {