1: <?php declare(strict_types=1);
2:
3: namespace Salient\Contract\Cli;
4:
5: use Salient\Contract\Console\ConsoleFormatterInterface as FormatterInterface;
6: use Salient\Contract\Core\Immutable;
7:
8: /**
9: * Formatting instructions for help messages
10: *
11: * @api
12: */
13: interface CliHelpStyleInterface extends Immutable
14: {
15: /**
16: * Get output formatter
17: */
18: public function getFormatter(): FormatterInterface;
19:
20: /**
21: * Get output width in columns after subtracting any margin widths
22: */
23: public function getWidth(): ?int;
24:
25: /**
26: * Get string to insert before and after bold text
27: */
28: public function getBold(): string;
29:
30: /**
31: * Get string to insert before and after italic text
32: */
33: public function getItalic(): string;
34:
35: /**
36: * Get escape character
37: */
38: public function getEscape(): string;
39:
40: /**
41: * Get string to insert before synopsis
42: */
43: public function getSynopsisPrefix(): string;
44:
45: /**
46: * Get string to insert between wrapped synopsis lines
47: */
48: public function getSynopsisNewline(): string;
49:
50: /**
51: * Get string to insert between long synopsis lines after wrapping, or an
52: * empty string to disable synopsis soft-wrapping
53: */
54: public function getSynopsisSoftNewline(): string;
55:
56: /**
57: * Check whether to collapse non-mandatory options to "[options]" when a
58: * wrapped synopsis breaks over multiple lines
59: */
60: public function getCollapseSynopsis(): bool;
61:
62: /**
63: * Get an instance where non-mandatory options are collapsed to "[options]"
64: * when a wrapped synopsis breaks over multiple lines
65: *
66: * @return static
67: */
68: public function withCollapseSynopsis(bool $value = true);
69:
70: /**
71: * Get string to insert before each option line
72: */
73: public function getOptionIndent(): string;
74:
75: /**
76: * Get string to insert before each option
77: */
78: public function getOptionPrefix(): string;
79:
80: /**
81: * Get string to insert before each option description
82: */
83: public function getOptionDescriptionPrefix(): string;
84:
85: /**
86: * Get option visibility flag to require
87: *
88: * @return CliOptionVisibility::*
89: */
90: public function getVisibility(): int;
91:
92: /**
93: * Reflow and optionally indent help message text
94: */
95: public function prepareHelp(string $text, string $indent = ''): string;
96:
97: /**
98: * Combine help message sections into one help message
99: *
100: * @param array<CliHelpSectionName::*|string,string> $sections
101: */
102: public function buildHelp(array $sections): string;
103:
104: /**
105: * Escape special characters in a string
106: */
107: public function maybeEscapeTags(string $string): string;
108: }
109: