@@ -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 | // temporary message |
@@ -8,10 +8,10 @@ discard block |
||
| 8 | 8 | // wait for a while, so we see the animation |
| 9 | 9 | sleep(3); |
| 10 | 10 | |
| 11 | -for ($i=1 ; $i<=100 ; $i++) { |
|
| 11 | +for ($i = 1; $i <= 100; $i++) { |
|
| 12 | 12 | |
| 13 | 13 | // progress message |
| 14 | - Console::overwrite(' I am a progress text... ('.Console::text($i.'%', 'green') .' completed)'); |
|
| 14 | + Console::overwrite(' I am a progress text... ('.Console::text($i.'%', 'green').' completed)'); |
|
| 15 | 15 | |
| 16 | 16 | // wait for a while, so we see the animation |
| 17 | 17 | usleep(100000); |
@@ -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 | // get columns and lines |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | $cols = Console::getColumns(); |
| 8 | 8 | |
| 9 | 9 | // print value |
| 10 | -Console::log(' The number of lines is currently: ' .Console::text($lines, 'green')); |
|
| 11 | -Console::log(' The number of columns is currently: ' .Console::text($cols, 'green')); |
|
| 10 | +Console::log(' The number of lines is currently: '.Console::text($lines, 'green')); |
|
| 11 | +Console::log(' The number of columns is currently: '.Console::text($cols, 'green')); |
|
| 12 | 12 | Console::log(); |
| 13 | 13 | |
| 14 | 14 | // build a 'full' row |
@@ -27,19 +27,19 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | function shutdown(){ |
| 30 | - // echo "\033c"; // Clear terminal |
|
| 31 | - // echo PHP_EOL; // New line |
|
| 32 | - Console::clear(); |
|
| 33 | - Console::clear(); |
|
| 34 | - Console::clear(); |
|
| 35 | - Console::clear(); |
|
| 36 | - Console::clear(); |
|
| 37 | - Console::log('SIGINT signal detected, terminate script...'); |
|
| 38 | - sleep(1); |
|
| 30 | + // echo "\033c"; // Clear terminal |
|
| 31 | + // echo PHP_EOL; // New line |
|
| 32 | + Console::clear(); |
|
| 33 | + Console::clear(); |
|
| 34 | + Console::clear(); |
|
| 35 | + Console::clear(); |
|
| 36 | + Console::clear(); |
|
| 37 | + Console::log('SIGINT signal detected, terminate script...'); |
|
| 38 | + sleep(1); |
|
| 39 | 39 | |
| 40 | - // .. |
|
| 41 | - // Console::restoreWindow(); |
|
| 42 | - exit(0); |
|
| 40 | + // .. |
|
| 41 | + // Console::restoreWindow(); |
|
| 42 | + exit(0); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | function printLoader($introDelay = 75000, $printAll = true) |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | Console::log(' '.Console::text("-----------------------------------------------------------------", "green")); |
| 59 | 59 | Console::log(' '.Console::text("kristuff/mishell: A mini PHP library to build CLI app and reports", "green")); |
| 60 | 60 | Console::log(' '.Console::text('Made with ', 'green') . Console::text('♥', 'red'). |
| 61 | - Console::text(' ', 'green'). |
|
| 62 | - Console::text(" | © 2017-2024 kri157uff", "green")); |
|
| 61 | + Console::text(' ', 'green'). |
|
| 62 | + Console::text(" | © 2017-2024 kri157uff", "green")); |
|
| 63 | 63 | Console::log(' '.Console::text("-----------------------------------------------------------------", "green")); |
| 64 | 64 | Console::log(); |
| 65 | 65 | usleep($introDelay * random_int(7, 11)); |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | $msg3 = Console::text(' [*]', $i==100 ? $hareColor : 'blue').Console::text(' |
@@ -1,11 +1,11 @@ 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 | -declare(ticks = 1); // Allow posix signal handling |
|
| 5 | +declare(ticks=1); // Allow posix signal handling |
|
| 6 | 6 | pcntl_async_signals(true); |
| 7 | -pcntl_signal(SIGINT,"shutdown"); |
|
| 8 | -register_shutdown_function("shutdown"); // Handle END of script |
|
| 7 | +pcntl_signal(SIGINT, "shutdown"); |
|
| 8 | +register_shutdown_function("shutdown"); // Handle END of script |
|
| 9 | 9 | |
| 10 | 10 | // Console::newWindow(); |
| 11 | 11 | // standWithUkraine("Stand with Ukraine <3", "Slava Ukraini"); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | askIndex(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | -function shutdown(){ |
|
| 29 | +function shutdown() { |
|
| 30 | 30 | // echo "\033c"; // Clear terminal |
| 31 | 31 | // echo PHP_EOL; // New line |
| 32 | 32 | Console::clear(); |
@@ -50,24 +50,24 @@ discard block |
||
| 50 | 50 | splash(); |
| 51 | 51 | Console::clear(); |
| 52 | 52 | Console::log(); |
| 53 | - Console::log(Console::text(" _ _ _ _ ", 'yellow').Console::text(' ', 'yellow').Console::text('', 'green') ); |
|
| 54 | - Console::log(Console::text(" _ __ (_)__| |_ ___| | | ", 'yellow').Console::text(' ', 'yellow').Console::text('', 'green') ); |
|
| 55 | - Console::log(Console::text(" | ' \| (_-< ' \/ -_) | | ", 'yellow').Console::text(' ', 'yellow').Console::text('', 'green') ); |
|
| 56 | - Console::log(Console::text(" |_|_|_|_/__/_||_\___|_|_| ", 'yellow').Console::text('By ', 'yellow').Console::text("kr157uff", 'green') ); |
|
| 53 | + Console::log(Console::text(" _ _ _ _ ", 'yellow').Console::text(' ', 'yellow').Console::text('', 'green')); |
|
| 54 | + Console::log(Console::text(" _ __ (_)__| |_ ___| | | ", 'yellow').Console::text(' ', 'yellow').Console::text('', 'green')); |
|
| 55 | + Console::log(Console::text(" | ' \| (_-< ' \/ -_) | | ", 'yellow').Console::text(' ', 'yellow').Console::text('', 'green')); |
|
| 56 | + Console::log(Console::text(" |_|_|_|_/__/_||_\___|_|_| ", 'yellow').Console::text('By ', 'yellow').Console::text("kr157uff", 'green')); |
|
| 57 | 57 | Console::log(); |
| 58 | 58 | Console::log(' '.Console::text("-----------------------------------------------------------------", "green")); |
| 59 | 59 | Console::log(' '.Console::text("kristuff/mishell: A mini PHP library to build CLI app and reports", "green")); |
| 60 | - Console::log(' '.Console::text('Made with ', 'green') . Console::text('♥', 'red'). |
|
| 60 | + Console::log(' '.Console::text('Made with ', 'green').Console::text('♥', 'red'). |
|
| 61 | 61 | Console::text(' ', 'green'). |
| 62 | 62 | Console::text(" | © 2017-2024 kri157uff", "green")); |
| 63 | 63 | Console::log(' '.Console::text("-----------------------------------------------------------------", "green")); |
| 64 | 64 | Console::log(); |
| 65 | - usleep($introDelay * random_int(7, 11)); |
|
| 65 | + usleep($introDelay*random_int(7, 11)); |
|
| 66 | 66 | $new = Console::text("NEW", 'green', 'blink'); |
| 67 | 67 | $fullRowString = Console::pad('', Console::getColumns()); |
| 68 | - $badgeOnline = Console::text(' ONLINE ', 'yellow', 'green'). ' '; |
|
| 68 | + $badgeOnline = Console::text(' ONLINE ', 'yellow', 'green').' '; |
|
| 69 | 69 | $badgeError = Console::text(' |
@@ -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,9 +1,9 @@ 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::log(' Let say we are current window.'); |
| 6 | -Console::log(' We will open a new window using ' . Console::text('Console::newWindow()', 'lightblue', 'underlined') . ' method.'); |
|
| 6 | +Console::log(' We will open a new window using '.Console::text('Console::newWindow()', 'lightblue', 'underlined').' method.'); |
|
| 7 | 7 | Console::ask(' Press [Enter] to open new window > '); |
| 8 | 8 | |
| 9 | 9 | // ------------------ |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | Console::log(' NEW WINDOW 1 ', 'green'); |
| 18 | 18 | Console::log(' _____________________________', 'green'); |
| 19 | 19 | Console::log(); |
| 20 | -Console::log(' I am in new window. We will restore the window later using ' . Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method.' ); |
|
| 20 | +Console::log(' I am in new window. We will restore the window later using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method.'); |
|
| 21 | 21 | Console::ask(' Press [Enter] to restore >'); |
| 22 | 22 | |
| 23 | 23 | // ------------------ |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | // ------------------ |
| 26 | 26 | Console::restoreWindow(); |
| 27 | 27 | |
| 28 | -Console::log(' We have now restored the current window using ' . Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method'); |
|
| 29 | -Console::log(' We will reopen a new window using ' . Console::text('Console::newWindow()', 'lightblue', 'underlined') . ' method.'); |
|
| 28 | +Console::log(' We have now restored the current window using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method'); |
|
| 29 | +Console::log(' We will reopen a new window using '.Console::text('Console::newWindow()', 'lightblue', 'underlined').' method.'); |
|
| 30 | 30 | Console::ask(' Press [Enter] to open new window > '); |
| 31 | 31 | |
| 32 | 32 | // ------------------ |
@@ -40,14 +40,14 @@ discard block |
||
| 40 | 40 | Console::log(' NEW WINDOW 2 ', 'yellow'); |
| 41 | 41 | Console::log(' _____________________________', 'yellow'); |
| 42 | 42 | Console::log(); |
| 43 | -Console::log(' I am in new window. We will restore the window later using ' . Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method.' ); |
|
| 43 | +Console::log(' I am in new window. We will restore the window later using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method.'); |
|
| 44 | 44 | Console::ask(' Press [Enter] to restore >'); |
| 45 | 45 | |
| 46 | 46 | // ------------------ |
| 47 | 47 | // restore new window |
| 48 | 48 | // ------------------ |
| 49 | 49 | Console::restoreWindow(); |
| 50 | -Console::log(' We have now restored the current window using ' . Console::text('Console::restoreWindow()', 'lightblue', 'underlined') . ' method. That\'s all.'); |
|
| 51 | -Console::log(' Got it'. Console::text('?', 'green')); |
|
| 50 | +Console::log(' We have now restored the current window using '.Console::text('Console::restoreWindow()', 'lightblue', 'underlined').' method. That\'s all.'); |
|
| 51 | +Console::log(' Got it'.Console::text('?', 'green')); |
|
| 52 | 52 | |
| 53 | 53 | ?> |
@@ -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,19 +10,19 @@ discard block |
||
| 10 | 10 | $cols = Console::getColumns(); |
| 11 | 11 | $middle = round($lines/2); |
| 12 | 12 | |
| 13 | -for ($i= 1; $i <= $lines ; $i++){ |
|
| 13 | +for ($i = 1; $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("Stand With Ukraine <3", $cols, ' ', STR_PAD_BOTH), 'yellow', 'blue'); |
| 18 | 18 | break; |
| 19 | 19 | case $middle: |
| 20 | 20 | Console::log(Console::pad(' ', $cols, ' ', STR_PAD_BOTH), 'yellow', 'blue'); |
| 21 | 21 | break; |
| 22 | - case $middle +1: |
|
| 22 | + case $middle+1: |
|
| 23 | 23 | Console::log(Console::pad(' ', $cols, ' ', STR_PAD_BOTH), 'blue', 'yellow'); |
| 24 | 24 | break; |
| 25 | - case $middle +2: |
|
| 25 | + case $middle+2: |
|
| 26 | 26 | Console::log(Console::pad('Slava Ukraini', $cols, ' ', STR_PAD_BOTH), 'blue', 'yellow'); |
| 27 | 27 | break; |
| 28 | 28 | case $lines: |