From 6684efab2fd9a8aff27e93129dd0d2e411fe4312 Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Thu, 7 Oct 2021 20:49:07 +0200 Subject: [PATCH] Improve CLI usage message format --- includes/cli.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/cli.php b/includes/cli.php index d417e9a..8cf50a2 100644 --- a/includes/cli.php +++ b/includes/cli.php @@ -42,7 +42,7 @@ function usage($error=false) { if ($error) echo "$error\n\n"; - printf(_("Usage: %s [-h] [-qd] command\n"), $argv[0]); + printf(_("Usage: %s [-h] [-qd] command\n"), basename($argv[0])); echo _(" -h Show this message\n"); echo _(" -q / -d Quiet/Debug mode\n"); echo _(" --trace Trace mode (the most verbose)\n"); @@ -53,8 +53,8 @@ function usage($error=false) { foreach ($cli_commands as $command => $info) { if ($cli_command && $command != $cli_command) continue; - echo " $command: "._($info['short_desc'])."\n"; - echo " ".$argv[0]." $command ".($info['usage_args']?_($info['usage_args']):'')."\n"; + echo " ".str_replace("\n", "\n ", wordwrap("$command : "._($info['short_desc'])))."\n\n"; + echo " ".basename($argv[0])." $command ".($info['usage_args']?_($info['usage_args']):'')."\n"; if ($info['long_desc']) { if (is_array($info['long_desc'])) { $lines = array();