You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$value = Console::askInt('Please enter a number > ');
103
-
104
-
if ($value!== false){
105
-
Console::log('=> The value you entered is ['. Console::text($value, 'yellow') .']');
106
-
}
107
-
```
108
-
### 1.1 Working with styles
109
-
110
-
To be more flexible, most writing/text/layout builder methods take an indefinite number of arguments called `[styles]`in this documentation.
111
-
The arguments are analyzed as follows:
112
-
113
-
- First argument that matchs to a known foreground color is taken as foreground color.
114
-
- First argument that matchs to a known background color (when a foreground color is already defined) is taken as background color (you cannot use a background color without set explicitly foreground color before).
115
-
- Other arguments that match to a known format are taken as formats.
116
-
117
-
So except for background that should be after foreground, style arguments order does not matter. Just note that the `'none'` argument will reset any previous style arguments.
118
-
119
-
Examples:
120
-
```php
121
-
<?php
122
-
Use Kristuff\Mishell\Console;
123
-
124
-
Console::log('some text', 'blue'); // prints a blue text
125
-
Console::log('some text', 'bold'); // prints a text style bold
126
-
Console::log('some text', 'lightblue', 'underlined'); // prints a blue underlined text
127
-
Console::log('some text', 'blue', 'white'); // prints a blue text on white
128
-
Console::log('some text', 'blue', 'white', 'underlined'); // prints a blue text on white and style underline
129
-
Console::log('some text', 'blue', 'white', 'underlined', 'bold'); // prints a blue text on white and styles underline+bold
130
-
131
-
// prints a blue text on white and style reverse (so => white on blue...)
`Console::print($str, [styles])`| Prints a [formatted] string in the console. |`void`|
206
-
`Console::log($str, [styles])`| Prints a [formatted] string in the console with new line. |`void`|
207
-
`Console::reLog($str, [styles])`| Prints or overwites the current line with a [formatted] string. |`void`|
208
-
`Console::ask($str, [styles])`| Prints a [formatted] string in the console and waits for an input. Returns that input. |`string`|
209
-
`Console::askInt($str, [styles])`| Prints a [formatted] string in the console and waits for an int input. |`int`|`bool` |
210
-
`Console::askPassword($str, [styles])`| Prints a [formatted] string in the console and waits for an input. Returns but does not print user input. |`string`|**Not supported** on windows platform
211
-
212
-
### 2.2 Text/layout builder methods
213
-
214
-
Method | Description | Return | Note
215
-
--- | --- | --- | ---
216
-
`Console::pad(TODO)`| TODO |`string`|
217
-
`Console::tableRow(TODO)`| TODO |`string`|
218
-
`Console::tableRowStart(TODO)`| TODO |`string`|
219
-
`Console::tableRowEmpty(TODO)`| TODO |`string`|
220
-
`Console::tableRowSeparator(TODO)`| TODO |`string`|
221
-
`Console::tableRowCell(TODO)`| TODO |`string`|
222
-
`Console::tableResetDefaults(TODO)`| TODO |`void`|
223
-
224
-
225
-
### 2.3 Misc
226
-
227
-
Method | Description | Return | Note
228
-
--- | --- | --- | ---
229
-
`Console::clear()`| Clear the console. |`void`|
230
-
`Console::bell()`| Play the bell if available. |`void`|
231
-
`Console::newWindow()`| Switch to a new window |`void`|
232
-
`Console::restoreWindow()`| Restore the previous window |`void`|
233
-
`Console::HideInput()`| Hide user input in window |`void`|**Not supported** on windows platform
234
-
`Console::restoreInput()`| Restore user input window |`void`|**Not supported** on windows platform
235
-
`Console::getLines()`| Get the number of lines in terminal |`int`|**Not supported** on windows platform
236
-
`Console::getColumns()`| Get the number of colums in terminal |`int`|**Not supported** on windows platform
237
-
238
-
[...] TODO
239
-
+ tables methods
240
-
+ enum styles
241
-
...
242
-
243
-
244
-
245
80
Bonus
246
81
-----
247
82
You can also do unuseful things like the blue screen of the death^^ Check the demo
@@ -253,7 +88,7 @@ License
253
88
254
89
The MIT License (MIT)
255
90
256
-
Copyright (c) 2017-2020 Kristuff
91
+
Copyright (c) 2017-2021 Kristuff
257
92
258
93
Permission is hereby granted, free of charge, to any person obtaining a copy
259
94
of this software and associated documentation files (the "Software"), to deal
0 commit comments