diff options
| author | 2024-01-17 07:42:43 +0000 | |
|---|---|---|
| committer | 2024-01-17 08:42:43 +0100 | |
| commit | 6d14813840d163c76f6dc25395b0007a88b42e9d (patch) | |
| tree | d01fccbd7e31f4fdccfc6649621ba1d8d75a9eef /cli/_update-or-create-user.php | |
| parent | 314077a457f04cc2f0472e036af029e2676fbf02 (diff) | |
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( ) -> [ ]
Diffstat (limited to 'cli/_update-or-create-user.php')
| -rw-r--r-- | cli/_update-or-create-user.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cli/_update-or-create-user.php b/cli/_update-or-create-user.php index 23666e3ae..1cc08bd25 100644 --- a/cli/_update-or-create-user.php +++ b/cli/_update-or-create-user.php @@ -4,8 +4,8 @@ require(__DIR__ . '/_cli.php'); performRequirementCheck(FreshRSS_Context::systemConf()->db['type'] ?? ''); -$parameters = array( - 'valid' => array( +$parameters = [ + 'long' => [ 'user' => ':', 'password' => ':', 'api-password' => ':', @@ -17,21 +17,22 @@ $parameters = array( 'feed-ttl-default' => ':', 'since-hours-posts-per-rss' => ':', 'max-posts-per-rss' => ':', - ), - 'deprecated' => array( + ], + 'short' => [], + 'deprecated' => [ 'api-password' => 'api_password', 'purge-after-months' => 'purge_after_months', 'feed-min-articles-default' => 'feed_min_articles_default', 'feed-ttl-default' => 'feed_ttl_default', 'since-hours-posts-per-rss' => 'since_hours_posts_per_rss', 'max-posts-per-rss' => 'max_posts_per_rss', - ), -); + ], +]; if (!isset($isUpdate)) { $isUpdate = false; } elseif (!$isUpdate) { - $parameters['valid']['no-default-feeds'] = ''; //Only for creating new users + $parameters['long']['no-default-feeds'] = ''; //Only for creating new users $parameters['deprecated']['no-default-feeds'] = 'no_default_feeds'; } |
