Skip to content

Commit ddb5cd9

Browse files
committed
Bump headings
1 parent 0a8a0c0 commit ddb5cd9

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed

README.md

Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,21 @@
6363
* [Docs Translations](#docs-translations)
6464
* [Integrations](#integrations)
6565

66-
### Minimum Requirements
66+
## Minimum Requirements
6767

6868
* PHP 7.1
6969
* Composer
7070
* ext-posix
7171

72-
### Installation
72+
## Installation
7373

7474
```bash
7575
composer require php-school/cli-menu
7676
```
7777

78-
### Usage
78+
## Usage
7979

80-
#### Quick Setup
80+
### Quick Setup
8181
Here is a super basic example menu which will echo out the text of the selected item to get you started.
8282
```php
8383
<?php
@@ -106,7 +106,7 @@ $menu = (new CliMenuBuilder)
106106
$menu->open();
107107
```
108108

109-
#### Examples
109+
### Examples
110110

111111
Check out the [examples](examples) directory and run them to see what is possible! The best way to run the examples is to git clone the repository:
112112

@@ -118,57 +118,57 @@ cd examples
118118
php basic.php
119119
```
120120

121-
##### Basic Menu
121+
#### Basic Menu
122122
<img width="600" alt="basic" src="https://cloud.githubusercontent.com/assets/2817002/11442386/cb0e41a2-950c-11e5-8dd6-913aeab1632a.png">
123123

124-
##### Basic Menu Auto Centered
124+
#### Basic Menu Auto Centered
125125
<img width="600" alt="submenu" src="https://user-images.githubusercontent.com/2817002/39929334-1c68a450-5538-11e8-947a-e97b21c4fa1a.png">
126126

127-
##### Basic Menu with separation
127+
#### Basic Menu with separation
128128
<img width="600" alt="basic-seperation" src="https://cloud.githubusercontent.com/assets/2817002/11442388/cdece950-950c-11e5-8128-4f849a1aea9f.png">
129129

130-
##### Menu with crazy separation
130+
#### Menu with crazy separation
131131
<img width="600" alt="crazy-seperation" src="https://cloud.githubusercontent.com/assets/2817002/11442389/d04627fc-950c-11e5-8c80-f82b8fe3f5da.png">
132132

133-
##### Custom Styles
133+
#### Custom Styles
134134
<img width="600" alt="custom-styles" src="https://cloud.githubusercontent.com/assets/2817002/11442391/d3d72d1c-950c-11e5-9698-c2aeec002b24.png">
135135

136-
##### Borders and 256 colours
136+
#### Borders and 256 colours
137137
<img width="600" alt="submenu" src="https://user-images.githubusercontent.com/2817002/39929340-1cee9fce-5538-11e8-91de-eccac734f2a5.png">
138138

139-
##### Useful Separation
139+
#### Useful Separation
140140
<img width="600" alt="useful-seperation" src="https://cloud.githubusercontent.com/assets/2817002/11442393/d862c72e-950c-11e5-8cbc-d8c73899627a.png">
141141

142-
##### Displaying Item Extra
142+
#### Displaying Item Extra
143143
<img width="600" alt="item-extra" src="https://cloud.githubusercontent.com/assets/2817002/11442395/dfe460f2-950c-11e5-9aed-9bc9c91b7ea6.png">
144144

145-
##### Remove Defaults
145+
#### Remove Defaults
146146
<img width="600" alt="remove-defaults" src="https://cloud.githubusercontent.com/assets/2817002/11442399/e3e8b8a6-950c-11e5-8dad-fdd4db93b850.png">
147147

148-
##### Submenu
148+
#### Submenu
149149
<img width="600" alt="submenu" src="https://cloud.githubusercontent.com/assets/2817002/11442401/e6f03ef2-950c-11e5-897a-6d55496a4105.png">
150150
<img width="600" alt="submenu-options" src="https://cloud.githubusercontent.com/assets/2817002/11442403/eaf4782e-950c-11e5-82c5-ab57f84cd6bc.png">
151151

152-
##### Disabled Items & Submenus
152+
#### Disabled Items & Submenus
153153
<img width="600" alt="submenu" src="https://cloud.githubusercontent.com/assets/2174476/19047849/868fa8c0-899b-11e6-9004-811c8da6d435.png">
154154

155-
##### Flash Dialogue
155+
#### Flash Dialogue
156156
<img width="600" alt="submenu" src="https://cloud.githubusercontent.com/assets/2817002/19786090/1f07dad6-9c94-11e6-91b0-c20ab2e6e27d.png">
157157

158-
##### Confirm Dialogue
158+
#### Confirm Dialogue
159159
<img width="600" alt="submenu" src="https://cloud.githubusercontent.com/assets/2817002/19786092/215d2dc2-9c94-11e6-910d-191b7b74f4d2.png">
160160

161-
##### Number Input
161+
#### Number Input
162162
<img width="600" alt="submenu" src="https://user-images.githubusercontent.com/2817002/39929969-bf45be46-5539-11e8-99f5-3dfdc0cf1fe3.png">
163163
<img width="600" alt="submenu" src="https://user-images.githubusercontent.com/2817002/39930002-d2353dd8-5539-11e8-8dfb-e404201b7c42.png">
164164

165-
##### Text Input
165+
#### Text Input
166166
<img width="600" alt="submenu" src="https://user-images.githubusercontent.com/2817002/39929338-1cbc5a28-5538-11e8-9a68-b4e84e772251.png">
167167

168-
##### Password Input
168+
#### Password Input
169169
<img width="600" alt="submenu" src="https://user-images.githubusercontent.com/2817002/39929339-1cd4cd2e-5538-11e8-9330-335dd1b7ed1c.png">
170170

171-
### API
171+
## API
172172

173173
The `CliMenu` object is constructed via the Builder class
174174

@@ -187,9 +187,9 @@ $menu->open();
187187
$menu->close();
188188
```
189189

190-
#### Appearance
190+
### Appearance
191191

192-
##### Menu Title
192+
#### Menu Title
193193

194194
You can give your menu a title and you can customise the separator, a line which displays under the title.
195195
Whatever string you pass to `setTitleSeparator` will be repeated for the width of the Menu.
@@ -201,7 +201,7 @@ $menu = (new CliMenuBuilder)
201201
->build();
202202
```
203203

204-
##### Colour
204+
#### Colour
205205

206206
You can change the foreground and background colour of the menu to any of the following colours:
207207

@@ -244,7 +244,7 @@ $menu = (new CliMenuBuilder)
244244
->build();
245245
```
246246

247-
##### Width
247+
#### Width
248248

249249
Customise the width of the menu. Setting a value larger than the size of the terminal will result in
250250
the width being the same as the terminal size. The width will include the padding and the border. So with a width of 100
@@ -256,7 +256,7 @@ $menu = (new CliMenuBuilder)
256256
->build();
257257
```
258258

259-
##### Padding
259+
#### Padding
260260

261261
The padding can be set for all sides with one value or can be set individually for top/bottom and left/right.
262262

@@ -283,7 +283,7 @@ $menu = (new CliMenuBuilder)
283283
->build();
284284
```
285285

286-
##### Margin
286+
#### Margin
287287

288288
The margin can be customised as one value. It is only applied to the left side of the menu. It can also be
289289
set automatically which will center the menu nicely in the terminal.
@@ -306,7 +306,7 @@ $menu = (new CliMenuBuilder)
306306
->build();
307307
```
308308

309-
##### Borders
309+
#### Borders
310310

311311
Borders can be customised just like CSS borders. We can add any amount of border to either side, left, right top or
312312
bottom and we can apply a colour to it.
@@ -344,7 +344,7 @@ $menu = (new CliMenuBuilder)
344344
->build();
345345
```
346346

347-
##### Exit Button Text
347+
#### Exit Button Text
348348

349349
Modify the exit button text:
350350

@@ -354,7 +354,7 @@ $menu = (new CliMenuBuilder)
354354
->build();
355355
```
356356

357-
##### Remove Exit Button
357+
#### Remove Exit Button
358358

359359
You can remove the exit button altogether:
360360

@@ -385,7 +385,7 @@ $menu = (new CliMenuBuilder)
385385
->build();
386386
```
387387

388-
#### Items
388+
### Items
389389

390390
There a few different types of items you can add to your menu
391391

@@ -395,7 +395,7 @@ There a few different types of items you can add to your menu
395395
* Ascii Art Item - Special item which allows usage of Ascii art. It takes care of padding and alignment.
396396
* Sub Menu Item - Special item to allow an item to open another menu. Useful for an options menu.
397397

398-
#### Selectable Item
398+
### Selectable Item
399399

400400
```php
401401
$menu = (new CliMenuBuilder)
@@ -424,7 +424,7 @@ $menu = (new CliMenuBuilder)
424424
Note: You can add as many items as you want and they can all have a different action. The action is the separate parameter
425425
and must be a valid PHP `callable`. Try using an `Invokable` class to keep your actions easily testable.
426426

427-
#### Line Break Item
427+
### Line Break Item
428428

429429
```php
430430
$menu = (new CliMenuBuilder)
@@ -434,7 +434,7 @@ $menu = (new CliMenuBuilder)
434434
435435
The above would repeat the character sequence `<3` across the Menu for 2 lines
436436
437-
#### Static Item
437+
### Static Item
438438
439439
Static items are similar to Line Breaks, however, they don't repeat and fill. It is output as is.
440440
If the text is longer than the width of the Menu, it will be continued on the next line.
@@ -450,7 +450,7 @@ $menu = (new CliMenuBuilder)
450450
->build();
451451
```
452452

453-
#### Ascii Art Item
453+
### Ascii Art Item
454454

455455
The following will place the Ascii art in the centre of your menu. Use these constants to alter the
456456
alignment:
@@ -479,7 +479,7 @@ The third optional parameter to `addAsciiArt` is alternate text. If the ascii ar
479479
it will not be displayed at all. However, if you pass a string to the third argument, in the case that the ascii art is too
480480
wide for the terminal the alternate text will be displayed instead.
481481

482-
#### Sub Menu Item
482+
### Sub Menu Item
483483

484484
Sub Menus are really powerful! You can add Menus to Menus, whattttt?? You can have your main menu and then an options menu.
485485
The options item will look like a normal item except when you hit it, you will enter to another menu, which
@@ -545,7 +545,7 @@ In this case `addSubMenu` will return the main menu builder, not the sub menu bu
545545
The submenu menu item will be an instance of `\PhpSchool\CliMenu\MenuItem\MenuMenuItem`. If you need access to the submenu,
546546
you can get it via `$menuMenuItem->getSubMenu()`.
547547

548-
#### Disabling Items & Sub Menus
548+
### Disabling Items & Sub Menus
549549

550550
In this example we are disabling certain items and a submenu but still having them shown in the output.
551551

@@ -576,7 +576,7 @@ The third param on the `->addItem` call is what disables an item while the `->di
576576

577577
The outcome is a full menu with dimmed rows to denote them being disabled. When a user navigates these items are jumped over to the next available selectable item.
578578

579-
##### Item Markers
579+
#### Item Markers
580580

581581
The marker displayed by the side of the currently active item can be modified, UTF-8 characters are supported.
582582
The marker for un-selected items can also be modified. If you want to disable it, just set it to a space character.
@@ -591,7 +591,7 @@ $menu = (new CliMenuBuilder)
591591
->build();
592592
```
593593

594-
#### Item Extra
594+
### Item Extra
595595

596596
You can optionally display some arbitrary text on the right hand side of an item. You can customise this text and
597597
you indicate which items to display it on. We use it to display `[COMPLETED]` on completed exercises, where the menu lists
@@ -606,12 +606,12 @@ $menu = (new CliMenuBuilder)
606606
->build();
607607
```
608608

609-
### Menu Methods
609+
## Menu Methods
610610

611611
The next set of documentation applies to methods available directly on the `\PhpSchool\CliMenu\CliMenu` instance. Typically
612612
you will invoke these methods whilst your menu is open in you action callbacks.
613613

614-
#### Redrawing the Menu
614+
### Redrawing the Menu
615615

616616
You can modify the menu and its style when executing an action and then you can redraw it! In this example we will toggle the background
617617
colour in an action.
@@ -654,7 +654,7 @@ $menu = (new CliMenuBuilder)
654654
$menu->open();
655655
```
656656

657-
#### Getting, Removing and Adding items
657+
### Getting, Removing and Adding items
658658

659659
You can also interact with the menu items in an action. You can add, remove and replace items. If you do this, you
660660
will likely want to redraw the menu as well so the new list is rendered.
@@ -692,7 +692,7 @@ $menu = (new CliMenuBuilder)
692692
$menu->open();
693693
```
694694

695-
#### Custom Control Mapping
695+
### Custom Control Mapping
696696

697697
This functionality allows to map custom key presses to a callable. For example we can set the key press "x" to close the menu:
698698

@@ -727,9 +727,9 @@ $menu->addCustomMapping('C', $myCallback);
727727
$menu->open();
728728
```
729729

730-
#### Dialogues
730+
### Dialogues
731731

732-
##### Flash
732+
#### Flash
733733

734734
Show a one line message over the top of the menu. It has a separate style object which is colored by default different
735735
to the menu. It can be modified to suit your own style. The dialogue is dismissed with any key press. In the example
@@ -758,7 +758,7 @@ $menu = (new CliMenuBuilder)
758758
$menu->open();
759759
```
760760

761-
##### Confirm
761+
#### Confirm
762762

763763
Prompts are very similar to flashes except that a button is shown which has to be selected to dismiss them. The button
764764
text can be customised.
@@ -784,7 +784,7 @@ $menu = (new CliMenuBuilder)
784784

785785
$menu->open();
786786
```
787-
#### Inputs
787+
### Inputs
788788

789789
Inputs - added in version 3.0 of `cli-menu` allow to prompt the user for input and validate it. The following types are supported:
790790
text, number and password. Inputs can be executed in any item callback. They have separate style objects which are colored by default different to the menu.
@@ -795,7 +795,7 @@ instance of the input you requested. To execute the prompt and wait for the inpu
795795
call `ask()` on the input. When the input has been received and validated, `ask()` will return
796796
an instance of `InputResult`. `InputResult` exposes the method `fetch` to grab the raw input.
797797

798-
##### Text Input
798+
#### Text Input
799799

800800
The text input will prompt for a string and when the enter key is hit it will validate that
801801
the string is not empty. As well as the style you can modify the prompt text (the default is 'Enter text:'), the
@@ -829,7 +829,7 @@ $menu->open();
829829

830830
```
831831

832-
##### Number Input
832+
#### Number Input
833833

834834
The number input will prompt for an integer value (signed or not) and when the enter key is hit it will validate that
835835
the input is actually a number (`/^-?\d+$/`). As well as the style you can modify the prompt text (the default is 'Enter a number:'), the
@@ -865,7 +865,7 @@ $menu->open();
865865

866866
```
867867

868-
##### Password Input
868+
#### Password Input
869869

870870
The password input will prompt for a text value and when the enter key is hit it will validate that the input is 16 characters or longer.
871871
As well as the style you can modify the prompt text (the default is 'Enter password:'), the
@@ -983,7 +983,7 @@ $menu->open();
983983

984984
```
985985

986-
##### Custom Input
986+
#### Custom Input
987987

988988
If you need a new type of input which is not covered by the bundled selection then you can create your own by implementing
989989
`\PhpSchool\CliMenu\Input\Input` - take a look at existing implementations to see how they are built. If all you need is some custom
@@ -1030,7 +1030,7 @@ $menu->open();
10301030
```
10311031

10321032

1033-
#### Dialogues & Input Styling
1033+
### Dialogues & Input Styling
10341034

10351035
All of the dialogues and inputs expose a `getStyle()` method which you can use to customise the appearance of them. However, if
10361036
you want to create a consistent style for all your dialogues and inputs without configuring it for each one
@@ -1072,12 +1072,12 @@ Once you get going you might just end up with something that looks a little like
10721072
You can see the construction code here for more clarity on how to perform advanced configuration:
10731073
[PHP School](https://github.com/php-school/php-workshop/blob/3240d3217bbf62b1063613fc13eb5adff2299bbe/src/Factory/MenuFactory.php)
10741074

1075-
### Docs Translations
1075+
## Docs Translations
10761076
_(This might not be kept up-to-date since it's a community translation)_
10771077
See this doc in [Brazilian Portuguese (pt_BR)](docs/pt_BR/README.md)
10781078

10791079

1080-
### Integrations
1080+
## Integrations
10811081

10821082
* [Symfony Console](https://github.com/RedAntNL/console)
10831083
* [Laravel](https://github.com/nunomaduro/laravel-console-menu)

0 commit comments

Comments
 (0)