From 6d14813840d163c76f6dc25395b0007a88b42e9d Mon Sep 17 00:00:00 2001 From: Kasimir Cash Date: Wed, 17 Jan 2024 07:42:43 +0000 Subject: Standardise command line option parsing (#6036) * Separates long & short options for parsing * Adds parsing for short options + doc rewrites * Fixes undefined constant in check.translation * Standardises CL option parsing * Refactors option parsing * Renames getLongOptions -> getOptions * Removes unused code * Converges on string typing for options * Updates docs & help files * Updates array syntax array( ) -> [ ] --- cli/reconfigure.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'cli/reconfigure.php') diff --git a/cli/reconfigure.php b/cli/reconfigure.php index da433c1a0..fde16c921 100755 --- a/cli/reconfigure.php +++ b/cli/reconfigure.php @@ -3,8 +3,8 @@ declare(strict_types=1); require(__DIR__ . '/_cli.php'); -$parameters = array( - 'valid' => array( +$parameters = [ + 'long' => [ 'environment' => ':', 'base-url' => ':', 'language' => ':', @@ -22,8 +22,9 @@ $parameters = array( 'db-password' => ':', 'db-base' => ':', 'db-prefix' => '::', - ), - 'deprecated' => array( + ], + 'short' => [], + 'deprecated' => [ 'base-url' => 'base_url', 'default-user' => 'default_user', 'allow-anonymous' => 'allow_anonymous', @@ -32,10 +33,10 @@ $parameters = array( 'api-enabled' => 'api_enabled', 'allow-robots' => 'allow_robots', 'disable-update' => 'disable_update', - ), -); + ], +]; -$configParams = array( +$configParams = [ 'environment', 'base-url', 'language', @@ -47,16 +48,16 @@ $configParams = array( 'api-enabled', 'allow-robots', 'disable-update', -); +]; -$dBconfigParams = array( +$dBconfigParams = [ 'db-type' => 'type', 'db-host' => 'host', 'db-user' => 'user', 'db-password' => 'password', 'db-base' => 'base', 'db-prefix' => 'prefix', -); +]; $options = parseCliParams($parameters); -- cgit v1.2.3