From 4517972afab71eaddf0c46423ffb4c3d13e20ace Mon Sep 17 00:00:00 2001 From: Inhere Date: Fri, 26 Nov 2021 14:24:46 +0800 Subject: [PATCH] style: update some for help render --- src/Util/FormatUtil.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Util/FormatUtil.php b/src/Util/FormatUtil.php index 805cc66..de0f97f 100644 --- a/src/Util/FormatUtil.php +++ b/src/Util/FormatUtil.php @@ -33,6 +33,7 @@ use function strpos; use function trim; use function ucfirst; +use function vdump; use function wordwrap; use const STR_PAD_RIGHT; @@ -150,7 +151,6 @@ public static function alignOptions(array $options): array // e.g '-h, --help' $hasShort = (bool)strpos(implode('', array_keys($options)), ','); - if (!$hasShort) { return $options; } @@ -161,8 +161,8 @@ public static function alignOptions(array $options): array continue; } - // padding length equals to '-h, ' - if (!str_contains($name, ',')) { + // start with '--', padding length equals to '-h, ' + if (isset($name[1]) && $name[1] === '-') { $name = ' ' . $name; } else { $name = str_replace([',-'], [', -'], $name);