@@ -31,6 +31,9 @@ class Options
31
31
/** @var Colors for colored help output */
32
32
protected $ colors ;
33
33
34
+ /** @var string newline used for spacing help texts */
35
+ protected $ newline = "\n" ;
36
+
34
37
/**
35
38
* Constructor
36
39
*
@@ -88,6 +91,16 @@ public function setCommandHelp($help)
88
91
$ this ->setup ['' ]['commandhelp ' ] = $ help ;
89
92
}
90
93
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
+
91
104
/**
92
105
* Register the names of arguments for help generation and number checking
93
106
*
@@ -366,7 +379,7 @@ public function help()
366
379
$ text .= '' . $ this ->bin ;
367
380
$ mv = 2 ;
368
381
} else {
369
- $ text .= "\n" ;
382
+ $ text .= $ this -> newline ;
370
383
$ text .= $ this ->colors ->wrap ('' . $ command , Colors::C_PURPLE );
371
384
$ mv = 4 ;
372
385
}
@@ -387,14 +400,14 @@ public function help()
387
400
}
388
401
$ text .= '' . $ out ;
389
402
}
390
- $ text .= "\n" ;
403
+ $ text .= $ this -> newline ;
391
404
392
405
// usage or command intro
393
406
if ($ this ->setup [$ command ]['help ' ]) {
394
407
$ text .= "\n" ;
395
408
$ text .= $ tf ->format (
396
409
array ($ mv , '* ' ),
397
- array ('' , $ this ->setup [$ command ]['help ' ] . "\n" )
410
+ array ('' , $ this ->setup [$ command ]['help ' ] . $ this -> newline )
398
411
);
399
412
}
400
413
@@ -425,7 +438,7 @@ public function help()
425
438
array ('' , $ name , $ opt ['help ' ]),
426
439
array ('' , 'green ' , '' )
427
440
);
428
- $ text .= "\n" ;
441
+ $ text .= $ this -> newline ;
429
442
}
430
443
}
431
444
@@ -435,7 +448,7 @@ public function help()
435
448
$ text .= "\n" ;
436
449
$ text .= $ this ->colors ->wrap ('ARGUMENTS: ' , Colors::C_BROWN );
437
450
}
438
- $ text .= "\n" ;
451
+ $ text .= $ this -> newline ;
439
452
foreach ($ this ->setup [$ command ]['args ' ] as $ arg ) {
440
453
$ name = '< ' . $ arg ['name ' ] . '> ' ;
441
454
@@ -456,7 +469,7 @@ public function help()
456
469
array ($ mv , '* ' ),
457
470
array ('' , $ commandhelp )
458
471
);
459
- $ text .= "\n" ;
472
+ $ text .= $ this -> newline ;
460
473
}
461
474
}
462
475
0 commit comments