@@ -31,6 +31,9 @@ class Options
3131 /** @var Colors for colored help output */
3232 protected $ colors ;
3333
34+ /** @var string newline used for spacing help texts */
35+ protected $ newline = "\n" ;
36+
3437 /**
3538 * Constructor
3639 *
@@ -88,6 +91,16 @@ public function setCommandHelp($help)
8891 $ this ->setup ['' ]['commandhelp ' ] = $ help ;
8992 }
9093
94+ /**
95+ * Use a more compact help screen with less new lines
96+ *
97+ * @param bool $set
98+ */
99+ public function useCompactHelp ($ set = true )
100+ {
101+ $ this ->newline = $ set ? '' : "\n" ;
102+ }
103+
91104 /**
92105 * Register the names of arguments for help generation and number checking
93106 *
@@ -366,7 +379,7 @@ public function help()
366379 $ text .= ' ' . $ this ->bin ;
367380 $ mv = 2 ;
368381 } else {
369- $ text .= "\n" ;
382+ $ text .= $ this -> newline ;
370383 $ text .= $ this ->colors ->wrap (' ' . $ command , Colors::C_PURPLE );
371384 $ mv = 4 ;
372385 }
@@ -387,14 +400,14 @@ public function help()
387400 }
388401 $ text .= ' ' . $ out ;
389402 }
390- $ text .= "\n" ;
403+ $ text .= $ this -> newline ;
391404
392405 // usage or command intro
393406 if ($ this ->setup [$ command ]['help ' ]) {
394407 $ text .= "\n" ;
395408 $ text .= $ tf ->format (
396409 array ($ mv , '* ' ),
397- array ('' , $ this ->setup [$ command ]['help ' ] . "\n" )
410+ array ('' , $ this ->setup [$ command ]['help ' ] . $ this -> newline )
398411 );
399412 }
400413
@@ -425,7 +438,7 @@ public function help()
425438 array ('' , $ name , $ opt ['help ' ]),
426439 array ('' , 'green ' , '' )
427440 );
428- $ text .= "\n" ;
441+ $ text .= $ this -> newline ;
429442 }
430443 }
431444
@@ -435,7 +448,7 @@ public function help()
435448 $ text .= "\n" ;
436449 $ text .= $ this ->colors ->wrap ('ARGUMENTS: ' , Colors::C_BROWN );
437450 }
438- $ text .= "\n" ;
451+ $ text .= $ this -> newline ;
439452 foreach ($ this ->setup [$ command ]['args ' ] as $ arg ) {
440453 $ name = '< ' . $ arg ['name ' ] . '> ' ;
441454
@@ -456,7 +469,7 @@ public function help()
456469 array ($ mv , '* ' ),
457470 array ('' , $ commandhelp )
458471 );
459- $ text .= "\n" ;
472+ $ text .= $ this -> newline ;
460473 }
461474 }
462475
0 commit comments