File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,8 @@ class Argument
8
8
private $ default ;
9
9
/** @var callable */
10
10
private $ validation ;
11
+ /** @var string */
12
+ private $ description ;
11
13
12
14
/**
13
15
* Creates a new argument.
@@ -16,14 +18,15 @@ class Argument
16
18
* @param callable|null $validation a validation function (optional)
17
19
* @throws \InvalidArgumentException
18
20
*/
19
- public function __construct ($ default = null , $ validation = null )
21
+ public function __construct ($ default = null , $ validation = null , $ description = " arg " )
20
22
{
21
23
if (!is_null ($ default )) {
22
24
$ this ->setDefaultValue ($ default );
23
25
}
24
26
if (!is_null ($ validation )) {
25
27
$ this ->setValidation ($ validation );
26
28
}
29
+ $ this ->description = $ description ;
27
30
}
28
31
29
32
/**
@@ -99,4 +102,14 @@ public function getDefaultValue()
99
102
{
100
103
return $ this ->default ;
101
104
}
105
+
106
+ /**
107
+ * Retrieve the descriptopm
108
+ *
109
+ * @return string
110
+ */
111
+ public function getDescription ()
112
+ {
113
+ return $ this ->description ;
114
+ }
102
115
}
Original file line number Diff line number Diff line change @@ -225,10 +225,10 @@ public function getHelpText($padding = 25)
225
225
$ mode = '' ;
226
226
break ;
227
227
case self ::REQUIRED_ARGUMENT :
228
- $ mode = "<arg > " ;
228
+ $ mode = "< " . $ option -> getArgument ()-> getDescription (). " > " ;
229
229
break ;
230
230
case self ::OPTIONAL_ARGUMENT :
231
- $ mode = "[<arg >] " ;
231
+ $ mode = "[< " . $ option -> getArgument ()-> getDescription (). " >] " ;
232
232
break ;
233
233
}
234
234
$ short = ($ option ->short ()) ? '- ' .$ option ->short () : '' ;
You can’t perform that action at this time.
0 commit comments