@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | Console::log(); |
117 | 117 | |
118 | 118 | foreach (getIndex() as $key => $value){ |
119 | - if (file_exists( __DIR__ . '/'. $value[2])) { |
|
119 | + if (file_exists( __DIR__ . '/'. $value[2])) { |
|
120 | 120 | Console::log(''. |
121 | 121 | Console::TableRowStart(). |
122 | 122 | Console::TableRowCell(Console::text($key,'lightgray'), 6, Console::ALIGN_CENTER). //no align => default is left |
@@ -162,24 +162,24 @@ discard block |
||
162 | 162 | printSampleHeader($selectedIndex, $title); |
163 | 163 | |
164 | 164 | Console::log($base . Console::text('Start running [', 'white') . |
165 | - Console::text( $title, 'lightcyan') . |
|
166 | - Console::text('] in file [', 'white') . |
|
167 | - Console::text( $fileName, 'lightcyan') . |
|
168 | - Console::text(']', 'white')); |
|
165 | + Console::text( $title, 'lightcyan') . |
|
166 | + Console::text('] in file [', 'white') . |
|
167 | + Console::text( $fileName, 'lightcyan') . |
|
168 | + Console::text(']', 'white')); |
|
169 | 169 | |
170 | 170 | if (file_exists($filePath)){ |
171 | 171 | Console::log(); |
172 | 172 | include $filePath; |
173 | 173 | Console::log(); |
174 | 174 | Console::log($base . Console::text('End running [', 'white') . |
175 | - Console::text( $title, 'lightcyan') . |
|
176 | - Console::text(']', 'white')); |
|
175 | + Console::text( $title, 'lightcyan') . |
|
176 | + Console::text(']', 'white')); |
|
177 | 177 | |
178 | - $response = Console::ask($base . Console::text('Do you want to see the code that has been executed? (type y/Y to see the code) > ', 'white')); |
|
179 | - if (strtoupper($response) === 'Y') { |
|
178 | + $response = Console::ask($base . Console::text('Do you want to see the code that has been executed? (type y/Y to see the code) > ', 'white')); |
|
179 | + if (strtoupper($response) === 'Y') { |
|
180 | 180 | Console::log($base . Console::text('The code in file [', 'white') . |
181 | - Console::text( $fileName, 'lightcyan') . |
|
182 | - Console::text('] is:', 'white')); |
|
181 | + Console::text( $fileName, 'lightcyan') . |
|
182 | + Console::text('] is:', 'white')); |
|
183 | 183 | Console::log(); |
184 | 184 | |
185 | 185 | $lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); |
@@ -197,10 +197,10 @@ discard block |
||
197 | 197 | Console::log(Console::pad(' ', 100, '-'), 'darkgray'); |
198 | 198 | Console::log(); |
199 | 199 | } |
200 | - } else { |
|
200 | + } else { |
|
201 | 201 | Console::log($base . Console::text('Error' , 'red')); |
202 | 202 | Console::log($base . Console::text(' => File missing [' . $fileName . ']' , 'red')); |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | } else { |
206 | 206 | Console::log($base . Console::text('Error:', 'red')); |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | 5 | Console::clear(); |
@@ -18,15 +18,15 @@ discard block |
||
18 | 18 | { |
19 | 19 | Console::log(); |
20 | 20 | Console::log(); |
21 | - Console::log(' '. Console::text(" _ ____ _ _ _ ", 'red')); |
|
22 | - Console::log(' '. Console::text(" _ __ ___ (_)/ ___|| |__ ___| | | ", 'red')); |
|
23 | - Console::log(' '. Console::text(" | '_ ` _ \| |\___ \| '_ \ / _ \ | | ", 'red')); |
|
24 | - Console::log(' '. Console::text(" | | | | | | | ___) | | | | __/ | | ", 'red')); |
|
25 | - Console::log(' '. Console::text(" |_| |_| |_|_||____/|_| |_|\___|_|_| ", 'red')); |
|
26 | - Console::log(' '. Console::text(" ", 'red')); |
|
27 | - Console::log(' '. Console::text(" Version 1.2 ", 'red')); |
|
28 | - Console::log(' '. Console::text(" © 2017-2020 Kristuff ", 'red')); |
|
29 | - Console::log(' '. Console::text(" ", 'red')); |
|
21 | + Console::log(' '.Console::text(" _ ____ _ _ _ ", 'red')); |
|
22 | + Console::log(' '.Console::text(" _ __ ___ (_)/ ___|| |__ ___| | | ", 'red')); |
|
23 | + Console::log(' '.Console::text(" | '_ ` _ \| |\___ \| '_ \ / _ \ | | ", 'red')); |
|
24 | + Console::log(' '.Console::text(" | | | | | | | ___) | | | | __/ | | ", 'red')); |
|
25 | + Console::log(' '.Console::text(" |_| |_| |_|_||____/|_| |_|\___|_|_| ", 'red')); |
|
26 | + Console::log(' '.Console::text(" ", 'red')); |
|
27 | + Console::log(' '.Console::text(" Version 1.2 ", 'red')); |
|
28 | + Console::log(' '.Console::text(" © 2017-2020 Kristuff ", 'red')); |
|
29 | + Console::log(' '.Console::text(" ", 'red')); |
|
30 | 30 | Console::log(); |
31 | 31 | Console::log(); |
32 | 32 | Console::log(); |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | $pad = ' '; |
35 | 35 | |
36 | 36 | // fake progress message |
37 | - for ($i=0 ; $i<=100 ; $i++) { |
|
37 | + for ($i = 0; $i <= 100; $i++) { |
|
38 | 38 | |
39 | 39 | // Overwrite progress message. |
40 | 40 | Console::relog($pad.Console::text('This is a fake progress message... [', 'white'). |
41 | - Console::text($i .'%', 'green'). |
|
41 | + Console::text($i.'%', 'green'). |
|
42 | 42 | Console::text('] completed', 'white')); |
43 | 43 | |
44 | 44 | // wait for a while, so we see the animation |
@@ -54,25 +54,25 @@ discard block |
||
54 | 54 | { |
55 | 55 | $index = []; |
56 | 56 | |
57 | - $index[1] = ['Styles', 'How to get available basic styles', 'demo.styles.php']; |
|
58 | - $index[2] = ['Colors', 'How to get available foreground colors', 'demo.colors.php']; |
|
59 | - $index[3] = ['Backgrounds', 'How to get available background colors', 'demo.bgcolors.php']; |
|
57 | + $index[1] = ['Styles', 'How to get available basic styles', 'demo.styles.php']; |
|
58 | + $index[2] = ['Colors', 'How to get available foreground colors', 'demo.colors.php']; |
|
59 | + $index[3] = ['Backgrounds', 'How to get available background colors', 'demo.bgcolors.php']; |
|
60 | 60 | // $index[4] = ['Text', 'Console::text() overview', 'demo.log.php']; |
61 | 61 | // $index[5] = ['Log', 'Console::log() overview', 'demo.log.php']; |
62 | 62 | // $index[6] = ['ReLog', 'Console::relog() overview', 'demo.relog.php']; |
63 | - $index[7] = ['Pad', 'Console::pad() overview', 'demo.pad.php']; |
|
64 | - $index[8] = ['Size', 'How to get the number of columns and lines in terminal', 'demo.size.php']; |
|
63 | + $index[7] = ['Pad', 'Console::pad() overview', 'demo.pad.php']; |
|
64 | + $index[8] = ['Size', 'How to get the number of columns and lines in terminal', 'demo.size.php']; |
|
65 | 65 | |
66 | - $index[11] = ['Ask', 'How to ask? (get user input)', 'demo.ask.php']; |
|
67 | - $index[12] = ['Ask Number', 'How to ask and expect a number?', 'demo.askint.php']; |
|
68 | - $index[13] = ['Ask Password', 'How to ask a password? (do not print user input)', 'demo.askpassword.php']; |
|
66 | + $index[11] = ['Ask', 'How to ask? (get user input)', 'demo.ask.php']; |
|
67 | + $index[12] = ['Ask Number', 'How to ask and expect a number?', 'demo.askint.php']; |
|
68 | + $index[13] = ['Ask Password', 'How to ask a password? (do not print user input)', 'demo.askpassword.php']; |
|
69 | 69 | |
70 | - $index[14] = ['Table', 'How to print a table?', 'demo.table.php']; |
|
71 | - $index[15] = ['Bell', 'How to run the bell?', 'demo.bell.php']; |
|
72 | - $index[16] = ['Progress', 'How to output progress message?', 'demo.progress.php']; |
|
73 | - $index[17] = ['New window', 'How to open new/restore window?', 'demo.window.php']; |
|
70 | + $index[14] = ['Table', 'How to print a table?', 'demo.table.php']; |
|
71 | + $index[15] = ['Bell', 'How to run the bell?', 'demo.bell.php']; |
|
72 | + $index[16] = ['Progress', 'How to output progress message?', 'demo.progress.php']; |
|
73 | + $index[17] = ['New window', 'How to open new/restore window?', 'demo.window.php']; |
|
74 | 74 | |
75 | - $index[20] = ['BlueScreen', 'Really nice full screen centered message sample', 'demo.bluescreen.php']; |
|
75 | + $index[20] = ['BlueScreen', 'Really nice full screen centered message sample', 'demo.bluescreen.php']; |
|
76 | 76 | |
77 | 77 | return $index; |
78 | 78 | } |
@@ -81,11 +81,11 @@ discard block |
||
81 | 81 | { |
82 | 82 | Console::clear(); |
83 | 83 | Console::log(); |
84 | - Console::log(Console::text(' Kristuff/Mishell ', 'darkgray') . Console::text(' v1.2 ', 'white', 'green')); |
|
85 | - Console::log(Console::text(' Made with ', 'darkgray') . Console::text('♥', 'red') . Console::text(' in France', 'darkgray')); |
|
84 | + Console::log(Console::text(' Kristuff/Mishell ', 'darkgray').Console::text(' v1.2 ', 'white', 'green')); |
|
85 | + Console::log(Console::text(' Made with ', 'darkgray').Console::text('♥', 'red').Console::text(' in France', 'darkgray')); |
|
86 | 86 | Console::log( |
87 | - Console::text(' © 2017-2020 Kristuff (', 'darkgray') . |
|
88 | - Console::text('https://github.com/kristuff)', 'darkgray', 'underlined') . |
|
87 | + Console::text(' © 2017-2020 Kristuff (', 'darkgray'). |
|
88 | + Console::text('https://github.com/kristuff)', 'darkgray', 'underlined'). |
|
89 | 89 | Console::text(')', 'darkgray') |
90 | 90 | ); |
91 | 91 | Console::log(); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | function printSampleHeader($index, $title) |
97 | 97 | { |
98 | - Console::log(' ' . Console::text(' - '. $index .' - ' . $title . ' ', 'white', 'blue')); |
|
98 | + Console::log(' '.Console::text(' - '.$index.' - '.$title.' ', 'white', 'blue')); |
|
99 | 99 | Console::log(); |
100 | 100 | } |
101 | 101 | |
@@ -115,11 +115,11 @@ discard block |
||
115 | 115 | Console::log(''.Console::tableRowSeparator($rowHeaders, 'darkgray')); |
116 | 116 | Console::log(); |
117 | 117 | |
118 | - foreach (getIndex() as $key => $value){ |
|
119 | - if (file_exists( __DIR__ . '/'. $value[2])) { |
|
118 | + foreach (getIndex() as $key => $value) { |
|
119 | + if (file_exists(__DIR__.'/'.$value[2])) { |
|
120 | 120 | Console::log(''. |
121 | 121 | Console::TableRowStart(). |
122 | - Console::TableRowCell(Console::text($key,'lightgray'), 6, Console::ALIGN_CENTER). //no align => default is left |
|
122 | + Console::TableRowCell(Console::text($key, 'lightgray'), 6, Console::ALIGN_CENTER).//no align => default is left |
|
123 | 123 | Console::TableRowCell(Console::text($value[0], 'lightgray'), 15). |
124 | 124 | Console::TableRowCell(Console::text($value[1], 'lightgray'), 55) |
125 | 125 | ); |
@@ -129,8 +129,8 @@ discard block |
||
129 | 129 | Console::log(''); |
130 | 130 | Console::log(''.Console::tableRowSeparator($rowHeaders, 'darkgray')); |
131 | 131 | Console::log(''); |
132 | - Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); |
|
133 | - Console::log(' '. Console::text(' - At any time you can stop this program using [') .Console::text('Ctrl+C', 'green') .Console::text(']')); |
|
132 | + Console::log(' '.Console::text('Tips:', 'underlined', 'bold')); |
|
133 | + Console::log(' '.Console::text(' - At any time you can stop this program using [').Console::text('Ctrl+C', 'green').Console::text(']')); |
|
134 | 134 | Console::log(''); |
135 | 135 | // reset table separators to defaults |
136 | 136 | Console::resetDefaults(); |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | |
139 | 139 | function askIndex() |
140 | 140 | { |
141 | - $base = Console::text(' kristuff/mishell-demo' , 'yellow'); |
|
142 | - $base .= Console::text('~$ ' , 'gray'); |
|
143 | - $selectedIndex = Console::askInt($base . Console::text(' Enter desired index then press [Enter] to run sample > ', 'white')); |
|
141 | + $base = Console::text(' kristuff/mishell-demo', 'yellow'); |
|
142 | + $base .= Console::text('~$ ', 'gray'); |
|
143 | + $selectedIndex = Console::askInt($base.Console::text(' Enter desired index then press [Enter] to run sample > ', 'white')); |
|
144 | 144 | $index = getIndex(); |
145 | 145 | |
146 | - switch($selectedIndex){ |
|
146 | + switch ($selectedIndex) { |
|
147 | 147 | case 0: |
148 | 148 | Console::log(); |
149 | 149 | // Console::restoreWindow(); |
@@ -155,30 +155,30 @@ discard block |
||
155 | 155 | |
156 | 156 | $title = $index[$selectedIndex][0]; |
157 | 157 | $fileName = $index[$selectedIndex][2]; |
158 | - $filePath = __DIR__ . '/'. $fileName; |
|
158 | + $filePath = __DIR__.'/'.$fileName; |
|
159 | 159 | |
160 | 160 | Console::clear(); |
161 | 161 | printHeader(); |
162 | 162 | printSampleHeader($selectedIndex, $title); |
163 | 163 | |
164 | - Console::log($base . Console::text('Start running [', 'white') . |
|
165 | - Console::text( $title, 'lightcyan') . |
|
166 | - Console::text('] in file [', 'white') . |
|
167 | - Console::text( $fileName, 'lightcyan') . |
|
164 | + Console::log($base.Console::text('Start running [', 'white'). |
|
165 | + Console::text($title, 'lightcyan'). |
|
166 | + Console::text('] in file [', 'white'). |
|
167 | + Console::text($fileName, 'lightcyan'). |
|
168 | 168 | Console::text(']', 'white')); |
169 | 169 | |
170 | - if (file_exists($filePath)){ |
|
170 | + if (file_exists($filePath)) { |
|
171 | 171 | Console::log(); |
172 | 172 | include $filePath; |
173 | 173 | Console::log(); |
174 | - Console::log($base . Console::text('End running [', 'white') . |
|
175 | - Console::text( $title, 'lightcyan') . |
|
174 | + Console::log($base.Console::text('End running [', 'white'). |
|
175 | + Console::text($title, 'lightcyan'). |
|
176 | 176 | Console::text(']', 'white')); |
177 | 177 | |
178 | - $response = Console::ask($base . Console::text('Do you want to see the code that has been executed? (type y/Y to see the code) > ', 'white')); |
|
178 | + $response = Console::ask($base.Console::text('Do you want to see the code that has been executed? (type y/Y to see the code) > ', 'white')); |
|
179 | 179 | if (strtoupper($response) === 'Y') { |
180 | - Console::log($base . Console::text('The code in file [', 'white') . |
|
181 | - Console::text( $fileName, 'lightcyan') . |
|
180 | + Console::log($base.Console::text('The code in file [', 'white'). |
|
181 | + Console::text($fileName, 'lightcyan'). |
|
182 | 182 | Console::text('] is:', 'white')); |
183 | 183 | Console::log(); |
184 | 184 | |
@@ -186,29 +186,29 @@ discard block |
||
186 | 186 | $count = 1; |
187 | 187 | |
188 | 188 | Console::log(Console::pad(' ', 100, '-'), 'darkgray'); |
189 | - foreach($lines as $line){ |
|
189 | + foreach ($lines as $line) { |
|
190 | 190 | $codeLine = rtrim($line); |
191 | 191 | $isComment = substr(ltrim($codeLine), 0, 2) === '//'; |
192 | 192 | $isPhp = substr(ltrim($codeLine), 0, 5) === '<?php' || substr(ltrim($codeLine), 0, 2) === '?>'; |
193 | 193 | $color = $isPhp ? 'blue' : ($isComment ? 'green' : 'lightgray'); |
194 | - Console::log(' '. Console::text($codeLine, $color)); |
|
194 | + Console::log(' '.Console::text($codeLine, $color)); |
|
195 | 195 | $count++; |
196 | 196 | } |
197 | 197 | Console::log(Console::pad(' ', 100, '-'), 'darkgray'); |
198 | 198 | Console::log(); |
199 | 199 | } |
200 | 200 | } else { |
201 | - Console::log($base . Console::text('Error' , 'red')); |
|
202 | - Console::log($base . Console::text(' => File missing [' . $fileName . ']' , 'red')); |
|
201 | + Console::log($base.Console::text('Error', 'red')); |
|
202 | + Console::log($base.Console::text(' => File missing ['.$fileName.']', 'red')); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | } else { |
206 | - Console::log($base . Console::text('Error:', 'red')); |
|
207 | - Console::log($base . Console::text('=> the value you entered is not a valid index number.', 'red')); |
|
206 | + Console::log($base.Console::text('Error:', 'red')); |
|
207 | + Console::log($base.Console::text('=> the value you entered is not a valid index number.', 'red')); |
|
208 | 208 | askIndex(); |
209 | 209 | } |
210 | 210 | |
211 | - Console::ask($base . Console::text('Press [Enter] to go back to index > ', 'white')); |
|
211 | + Console::ask($base.Console::text('Press [Enter] to go back to index > ', 'white')); |
|
212 | 212 | goIndex(); |
213 | 213 | } |
214 | 214 | } |
215 | 215 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); |
10 | 10 | Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); |
11 | 11 | Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . |
12 | - ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
12 | + ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
13 | 13 | Console::log(); |
14 | 14 | Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); |
15 | 15 | Console::log(' '. Console::text("\$value = Console::ask('Please enter something > ');", 'lightmagenta')); |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | use Kristuff\Mishell\Console; |
5 | 5 | |
6 | -Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); |
|
7 | -Console::log(' '. Console::text(" - Use ") . Console::text("string ", 'blue'). Console::text("Console::ask()", 'lightblue', 'underlined') . " to ask something to user in the console."); |
|
6 | +Console::log(' '.Console::text('Overview:', 'underlined', 'bold')); |
|
7 | +Console::log(' '.Console::text(" - Use ").Console::text("string ", 'blue').Console::text("Console::ask()", 'lightblue', 'underlined')." to ask something to user in the console."); |
|
8 | 8 | Console::log(); |
9 | -Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); |
|
9 | +Console::log(' '.Console::text('Tips:', 'underlined', 'bold')); |
|
10 | 10 | Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); |
11 | -Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . |
|
12 | - ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
11 | +Console::log(' with '.Console::text("Console::text()", 'lightblue', 'underlined'). |
|
12 | + ' and '.Console::text("Console::log()", 'lightblue', 'underlined').' methods.'); |
|
13 | 13 | Console::log(); |
14 | -Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); |
|
15 | -Console::log(' '. Console::text("\$value = Console::ask('Please enter something > ');", 'lightmagenta')); |
|
16 | -Console::log(' '. Console::text("// or", 'green')); |
|
17 | -Console::log(' '. Console::text("\$value = Console::ask('Please enter something > ', 'white', 'blue);", 'lightmagenta')); |
|
14 | +Console::log(' '.Console::text('Usage:', 'underlined', 'bold')); |
|
15 | +Console::log(' '.Console::text("\$value = Console::ask('Please enter something > ');", 'lightmagenta')); |
|
16 | +Console::log(' '.Console::text("// or", 'green')); |
|
17 | +Console::log(' '.Console::text("\$value = Console::ask('Please enter something > ', 'white', 'blue);", 'lightmagenta')); |
|
18 | 18 | Console::log(); |
19 | 19 | |
20 | 20 | // ----------------- |
21 | 21 | // sample start here |
22 | 22 | // ----------------- |
23 | 23 | $value = Console::ask('Please enter something > '); |
24 | -Console::log('=> the value you entered is [' . Console::text($value, 'lightyellow') . ']'); |
|
24 | +Console::log('=> the value you entered is ['.Console::text($value, 'lightyellow').']'); |
|
25 | 25 | |
26 | 26 | $value2 = Console::ask('Please enter something > ', 'magenta', 'underlined'); |
27 | -Console::log('=> the value you entered is [' . Console::text($value2, 'lightyellow') . ']'); |
|
27 | +Console::log('=> the value you entered is ['.Console::text($value2, 'lightyellow').']'); |
|
28 | 28 | |
29 | 29 | ?> |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | 5 | // the row header |
6 | -$rowHeaders = [ 'Style name' => 15, 'ANSI Code' => 15, 'Sample ouput' => 50 ]; |
|
6 | +$rowHeaders = ['Style name' => 15, 'ANSI Code' => 15, 'Sample ouput' => 50]; |
|
7 | 7 | Console::log(' '.Console::tableRowSeparator($rowHeaders)); |
8 | 8 | Console::log(' '.Console::tableRow($rowHeaders)); |
9 | 9 | Console::log(' '.Console::tableRowSeparator($rowHeaders)); |
10 | 10 | |
11 | 11 | // enum styles |
12 | 12 | $index = 1; |
13 | -foreach (Console::getStyles()[ 'options' ] as $option => $value){ |
|
14 | - Console::log(' ' . |
|
13 | +foreach (Console::getStyles()['options'] as $option => $value) { |
|
14 | + Console::log(' '. |
|
15 | 15 | Console::tableRow([ |
16 | 16 | $option => 15, |
17 | - "\\033[" . $value .'m' => 15, |
|
18 | - Console::text('I am a text style={' . $option .'}', $option) => 50 |
|
17 | + "\\033[".$value.'m' => 15, |
|
18 | + Console::text('I am a text style={'.$option.'}', $option) => 50 |
|
19 | 19 | ])); |
20 | 20 | $index++; |
21 | 21 | } |
@@ -8,7 +8,7 @@ |
||
8 | 8 | Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); |
9 | 9 | Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); |
10 | 10 | Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . |
11 | - ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
11 | + ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
12 | 12 | Console::log(); |
13 | 13 | Console::log(' '. Console::text('Warning:', 'underlined', 'bold')); |
14 | 14 | Console::log(' '. Console::text("User input are not hidden on windows platform (not supported)", 'red', 'yellow')); |
@@ -1,30 +1,30 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | -Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); |
|
6 | -Console::log(' Use ' . Console::text("string ", 'blue'). Console::text("Console::askPassword()", 'lightblue', 'underlined') . " to ask user to enter a value and return this value.", 'white'); |
|
5 | +Console::log(' '.Console::text('Overview:', 'underlined', 'bold')); |
|
6 | +Console::log(' Use '.Console::text("string ", 'blue').Console::text("Console::askPassword()", 'lightblue', 'underlined')." to ask user to enter a value and return this value.", 'white'); |
|
7 | 7 | Console::log(); |
8 | -Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); |
|
8 | +Console::log(' '.Console::text('Tips:', 'underlined', 'bold')); |
|
9 | 9 | Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); |
10 | -Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . |
|
11 | - ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
10 | +Console::log(' with '.Console::text("Console::text()", 'lightblue', 'underlined'). |
|
11 | + ' and '.Console::text("Console::log()", 'lightblue', 'underlined').' methods.'); |
|
12 | 12 | Console::log(); |
13 | -Console::log(' '. Console::text('Warning:', 'underlined', 'bold')); |
|
14 | -Console::log(' '. Console::text("User input are not hidden on windows platform (not supported)", 'red', 'yellow')); |
|
13 | +Console::log(' '.Console::text('Warning:', 'underlined', 'bold')); |
|
14 | +Console::log(' '.Console::text("User input are not hidden on windows platform (not supported)", 'red', 'yellow')); |
|
15 | 15 | Console::log(); |
16 | -Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); |
|
17 | -Console::log(' ' . Console::text("\$value = Console::askPassword('Please Enter something (We wont display it, for now...) > ');", 'lightmagenta')); |
|
18 | -Console::log(' ' . Console::text("Console::log();", 'lightmagenta')); |
|
19 | -Console::log(' ' . Console::text("Console::log('=> the value you entered is [' . Console::text(\$value, 'red') . ']');", 'lightmagenta')); |
|
16 | +Console::log(' '.Console::text('Usage:', 'underlined', 'bold')); |
|
17 | +Console::log(' '.Console::text("\$value = Console::askPassword('Please Enter something (We wont display it, for now...) > ');", 'lightmagenta')); |
|
18 | +Console::log(' '.Console::text("Console::log();", 'lightmagenta')); |
|
19 | +Console::log(' '.Console::text("Console::log('=> the value you entered is [' . Console::text(\$value, 'red') . ']');", 'lightmagenta')); |
|
20 | 20 | Console::log(); |
21 | -Console::log(' '. Console::text('Sample:', 'underlined', 'bold')); |
|
21 | +Console::log(' '.Console::text('Sample:', 'underlined', 'bold')); |
|
22 | 22 | |
23 | 23 | // ----------------- |
24 | 24 | // sample start here |
25 | 25 | // ----------------- |
26 | 26 | $value = Console::askPassword(' Please Enter something (We wont display it, for now... (except on windows) > '); |
27 | 27 | Console::log(); |
28 | -Console::log(' => the value you entered is [' . Console::text($value, 'red') . ']'); |
|
28 | +Console::log(' => the value you entered is ['.Console::text($value, 'red').']'); |
|
29 | 29 | |
30 | 30 | ?> |
31 | 31 | \ No newline at end of file |
@@ -9,7 +9,7 @@ |
||
9 | 9 | Console::log(" - The method returns " . Console::text("int", 'blue') . " value or " . Console::text("false", 'blue'). " if the entered value is not a valid int number."); |
10 | 10 | Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); |
11 | 11 | Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . |
12 | - ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
12 | + ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
13 | 13 | Console::log(); |
14 | 14 | Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); |
15 | 15 | Console::log(' ' . Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); |
@@ -1,29 +1,29 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | -Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); |
|
6 | -Console::log(" - Use " . Console::text("int|bool ", 'blue') . Console::text("Console::askInt()", 'lightblue', 'underlined') . " to ask user to enter a number in the console."); |
|
5 | +Console::log(' '.Console::text('Overview:', 'underlined', 'bold')); |
|
6 | +Console::log(" - Use ".Console::text("int|bool ", 'blue').Console::text("Console::askInt()", 'lightblue', 'underlined')." to ask user to enter a number in the console."); |
|
7 | 7 | Console::log(); |
8 | -Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); |
|
9 | -Console::log(" - The method returns " . Console::text("int", 'blue') . " value or " . Console::text("false", 'blue'). " if the entered value is not a valid int number."); |
|
8 | +Console::log(' '.Console::text('Tips:', 'underlined', 'bold')); |
|
9 | +Console::log(" - The method returns ".Console::text("int", 'blue')." value or ".Console::text("false", 'blue')." if the entered value is not a valid int number."); |
|
10 | 10 | Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); |
11 | -Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . |
|
12 | - ' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); |
|
11 | +Console::log(' with '.Console::text("Console::text()", 'lightblue', 'underlined'). |
|
12 | + ' and '.Console::text("Console::log()", 'lightblue', 'underlined').' methods.'); |
|
13 | 13 | Console::log(); |
14 | -Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); |
|
15 | -Console::log(' ' . Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); |
|
16 | -Console::log(' ' . Console::text("if (\$value !== false) {", 'lightmagenta')); |
|
17 | -Console::log(' ' . Console::text("// Do something with \$value", 'green')); |
|
14 | +Console::log(' '.Console::text('Usage:', 'underlined', 'bold')); |
|
15 | +Console::log(' '.Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); |
|
16 | +Console::log(' '.Console::text("if (\$value !== false) {", 'lightmagenta')); |
|
17 | +Console::log(' '.Console::text("// Do something with \$value", 'green')); |
|
18 | 18 | Console::log(); |
19 | -Console::log(' '. Console::text('Sample:', 'underlined', 'bold')); |
|
19 | +Console::log(' '.Console::text('Sample:', 'underlined', 'bold')); |
|
20 | 20 | |
21 | 21 | // ----------------- |
22 | 22 | // sample start here |
23 | 23 | // ----------------- |
24 | 24 | $value = Console::askInt(' Please enter a number > '); |
25 | -if ($value !== false){ |
|
26 | - Console::log(' => The value you entered is [' . Console::text($value, 'yellow') . ']'); |
|
25 | +if ($value !== false) { |
|
26 | + Console::log(' => The value you entered is ['.Console::text($value, 'yellow').']'); |
|
27 | 27 | } else { |
28 | 28 | Console::log(Console::text(' Error:', 'red')); |
29 | 29 | Console::log(Console::text(' => the value you entered is not a valid number.', 'red')); |
@@ -1,16 +1,16 @@ |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | -Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); |
|
6 | -Console::log(' - Use ' . Console::text("Console::bell()", 'lightblue', 'underlined') . ' to play a bell sound in console (if available).', 'white'); |
|
5 | +Console::log(' '.Console::text('Overview:', 'underlined', 'bold')); |
|
6 | +Console::log(' - Use '.Console::text("Console::bell()", 'lightblue', 'underlined').' to play a bell sound in console (if available).', 'white'); |
|
7 | 7 | Console::log(); |
8 | -Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); |
|
8 | +Console::log(' '.Console::text('Usage:', 'underlined', 'bold')); |
|
9 | 9 | Console::log(); |
10 | -Console::log(' ' .Console::text('// Play the bell', 'green')); |
|
11 | -Console::log(' ' .Console::text('Console::bell();', 'lightmagenta')); |
|
10 | +Console::log(' '.Console::text('// Play the bell', 'green')); |
|
11 | +Console::log(' '.Console::text('Console::bell();', 'lightmagenta')); |
|
12 | 12 | Console::log(); |
13 | -Console::log(' '. Console::text('Sample:', 'underlined', 'bold')); |
|
13 | +Console::log(' '.Console::text('Sample:', 'underlined', 'bold')); |
|
14 | 14 | |
15 | 15 | // ----------------- |
16 | 16 | // sample start here |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | 5 | // *open* new window |
@@ -10,16 +10,16 @@ discard block |
||
10 | 10 | $cols = Console::getColumns(); |
11 | 11 | $middle = round($lines/2); |
12 | 12 | |
13 | -for ($i= 0; $i <= $lines ; $i++){ |
|
13 | +for ($i = 0; $i <= $lines; $i++) { |
|
14 | 14 | |
15 | - switch($i){ |
|
16 | - case $middle -1: |
|
15 | + switch ($i) { |
|
16 | + case $middle-1: |
|
17 | 17 | Console::log(Console::pad(":( Houston, we've had a problem...", $cols, ' ', STR_PAD_BOTH), 'white', 'blue'); |
18 | 18 | break; |
19 | 19 | case $middle : |
20 | 20 | Console::log(Console::pad('an error occurred in my head,', $cols, ' ', STR_PAD_BOTH), 'white', 'blue'); |
21 | 21 | break; |
22 | - case $middle +1: |
|
22 | + case $middle+1: |
|
23 | 23 | Console::log(Console::pad('I really want you to see the blue screen of the death', $cols, ' ', STR_PAD_BOTH), 'white', 'blue'); |
24 | 24 | break; |
25 | 25 | default: |
@@ -12,9 +12,9 @@ |
||
12 | 12 | $i = 1; |
13 | 13 | foreach (Console::getStyles()['foregrounds'] as $color => $colorValue ){ |
14 | 14 | Console::log(' '.Console::tableRow([ |
15 | - ' ' . $i => 7, |
|
15 | + ' ' . $i => 7, |
|
16 | 16 | $color => 15, |
17 | - "\\033[" . $colorValue .'m' => 15, |
|
17 | + "\\033[" . $colorValue .'m' => 15, |
|
18 | 18 | Console::text(str_pad('I am a text color={' . $color .'}', 48), $color) => 50 |
19 | 19 | ])); |
20 | 20 | $i++; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once __DIR__ .'/../vendor/autoload.php'; |
|
2 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
3 | 3 | use Kristuff\Mishell\Console; |
4 | 4 | |
5 | 5 | // headers |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | |
11 | 11 | // loop into foregrounds |
12 | 12 | $i = 1; |
13 | -foreach (Console::getStyles()['foregrounds'] as $color => $colorValue ){ |
|
13 | +foreach (Console::getStyles()['foregrounds'] as $color => $colorValue) { |
|
14 | 14 | Console::log(' '.Console::tableRow([ |
15 | - ' ' . $i => 7, |
|
15 | + ' '.$i => 7, |
|
16 | 16 | $color => 15, |
17 | - "\\033[" . $colorValue .'m' => 15, |
|
18 | - Console::text(str_pad('I am a text color={' . $color .'}', 48), $color) => 50 |
|
17 | + "\\033[".$colorValue.'m' => 15, |
|
18 | + Console::text(str_pad('I am a text color={'.$color.'}', 48), $color) => 50 |
|
19 | 19 | ])); |
20 | 20 | $i++; |
21 | 21 | } |