-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from kristuff/develop
1.6
- Loading branch information
Showing
53 changed files
with
2,532 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
doc/ export-ignore | ||
demo/ export-ignore | ||
tests/ export-ignore | ||
vendor/ export-ignore | ||
demo/ export-ignore | ||
doc/ export-ignore | ||
.gitattributes export-ignore | ||
README.* export-ignore | ||
composer.* export-ignore | ||
.gitignore export-ignore | ||
.codeclimate.yml export-ignore | ||
.travis.yml export-ignore | ||
composer.* export-ignore | ||
phpunit.xml export-ignore | ||
README.* export-ignore | ||
CHANGELOG.* export-ignore | ||
CHANGELOG.* export-ignore | ||
.gitattributes export-ignore | ||
.codeclimate.yml export-ignore | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
require_once __DIR__ .'/../vendor/autoload.php'; | ||
use Kristuff\Mishell\Console; | ||
|
||
Console::log(); | ||
Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); | ||
Console::log(" - Use " . Console::text("Console::overwrite()", 'lightblue', 'underlined') . " to overwrite the last printed line.", 'white'); | ||
Console::log(); | ||
|
||
Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); | ||
Console::log(" - " . Console::text('No need', 'underlined', 'bold') ." to use " . Console::text("php str_pad()", 'lightblue', 'underlined') . " method like with " .Console::text("Console::relog()", 'lightblue', 'underlined') ); | ||
Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); | ||
Console::log(' ' .Console::text("Console::text()", 'lightblue', 'underlined') . | ||
' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); | ||
Console::log(); | ||
Console::log(' '. Console::text('Basic usage:', 'underlined', 'bold')); | ||
Console::log(); | ||
Console::log(" Console::log('I am a real log line, with \\n, but I will be erased');"); | ||
Console::log(" Console::overwrite('I am new real line.');"); | ||
Console::log(); | ||
Console::log(' ' .Console::text('Sample code:', 'underlined', 'bold')); | ||
Console::log(); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
require_once __DIR__ .'/../vendor/autoload.php'; | ||
use Kristuff\Mishell\Console; | ||
|
||
// temporary message | ||
Console::log(' I am a temporary message... I will be erased :(', 'red'); | ||
|
||
// wait for a while, so we see the animation | ||
sleep(3); | ||
|
||
for ($i=1 ; $i<=100 ; $i++) { | ||
|
||
// progress message | ||
Console::overwrite(' I am a progress text... ('.Console::text($i.'%', 'green') .' completed)'); | ||
|
||
// wait for a while, so we see the animation | ||
usleep(100000); | ||
} | ||
|
||
// Overwrite message again | ||
Console::overwrite(' '.Console::text('Process complete.', 'white', 'green', 'underlined')); | ||
|
||
// wait for a while, so we see the animation | ||
usleep(2000000); | ||
|
||
// Overwrite message again | ||
Console::overwrite(' Oh wait, I forgot something...', 'red'); | ||
|
||
// wait for a while, so we see the animation | ||
usleep(2000000); | ||
|
||
// Overwrite message again | ||
Console::overwrite(' '.Console::text('StandWith', 'yellow', 'blue').Console::text('Ukraine', 'blue', 'yellow')); | ||
|
||
// wait for a while, so we see the animation | ||
usleep(2000000); | ||
|
||
// Overwrite message again (last time). | ||
Console::overwrite(' Process complete', 'green', 'bold'); | ||
|
||
// new blank line | ||
Console::log(); | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
require_once __DIR__ .'/../vendor/autoload.php'; | ||
use Kristuff\Mishell\Console; | ||
|
||
|
||
Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); | ||
Console::log(' '. Console::text('- Using ','white').Console::text("Console::overwrite()", 'lightblue', 'underlined').Console::text('you can overwrite more than one row.', 'white')); | ||
Console::log(' '. Console::text('To overwrite the 2 last printed rows, you need to pass an array of 2 ','white').Console::text("string", 'lightblue', '').' '. Console::text('.', 'white')); | ||
Console::log(); | ||
|
||
Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); | ||
Console::log(" - " . Console::text('No need', 'underlined', 'bold') ." to use " . Console::text("php str_pad()", 'lightblue', 'underlined') . " method like with " .Console::text("Console::relog()", 'lightblue', 'underlined') ); | ||
Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); | ||
Console::log(' ' .Console::text("Console::text()", 'lightblue', 'underlined') . | ||
' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); | ||
Console::log(); | ||
Console::log(' '. Console::text('Basic usage:', 'underlined', 'bold')); | ||
Console::log(); | ||
Console::log(" Console::log('I am a real log line, with \\n, but I will be erased');"); | ||
Console::log(" Console::log('I am another real log line, with \\n, but I will be erased');"); | ||
Console::log(" Console::overwrite('I am new real line.');"); | ||
Console::log(); | ||
Console::log(' ' .Console::text('Sample code:', 'underlined', 'bold')); | ||
Console::log(); | ||
// ----------------- | ||
// sample start here | ||
// ----------------- | ||
|
||
$msg1 = Console::text(' [*]', 'blue'). Console::text(' Tortoise vs Hare Race will starting. Place your bets! ...', 'white'); | ||
$msg2 = Console::text(' [*]', 'blue').Console::text(' 🐢 ', 'lightgreen').Console::text('Tortoise progress ... ', 'white'); | ||
$msg3 = Console::text(' [*]', 'blue').Console::text(' 🐇 ', 'white').Console::text('Hare progress ... ', 'white'); | ||
|
||
Console::log($msg1); | ||
Console::log(); | ||
Console::log($msg2); | ||
Console::log(); | ||
Console::log($msg3); | ||
Console::log(); | ||
|
||
// wait for a momment, so we see the animation | ||
sleep(3); | ||
|
||
$harePurcent = 0; | ||
$tortPurcent = 0; | ||
$hareColor = 'green'; | ||
$tortoiseColor = 'red'; | ||
$totalLines = Console::getLines(); | ||
|
||
for ($i=1 ; $i<=100 ; $i++) { | ||
|
||
// Added by Tortoise1337 | ||
// Optimization seems legit | ||
$isOdd = ($i % 2 == 0); | ||
if ($i < 75 ){ | ||
$isOdd && $tortPurcent++; | ||
} else { | ||
$tortPurcent = min($tortPurcent + 3, 100); | ||
} | ||
|
||
$harePurcent++; | ||
$loserColor = ($i== 100) ? 'red' : 'yellow'; | ||
$tortColor = $tortPurcent >= $harePurcent ? 'green' : $loserColor; | ||
$hareColor = $tortPurcent < $harePurcent ? 'green' : $loserColor; | ||
$msg1 = $i==100 ? | ||
Console::text(' [*]', 'blue').Console::text(' Tortoise vs Hare Race - Final Results', 'white') : | ||
Console::text(' [*]', 'blue').Console::text(' Tortoise vs Hare Race: ', 'white').Console::text(' RUNNING ', 'white', 'yellow'). ' ' ; | ||
$msg2 = Console::text(' [*]', $i==100 ? $tortColor : 'blue').Console::text(' 🐢 ', 'lightgreen').Console::text('Tortoise progress: ', 'white').Console::progressBar($tortPurcent, $tortColor, $tortColor,'darkgray', 60, ' '); | ||
$msg3 = Console::text(' [*]', $i==100 ? $hareColor : 'blue').Console::text(' 🐇 ', 'white'). Console::text('Hare progress: ', 'white').Console::progressBar($harePurcent, $hareColor, $hareColor,'darkgray', 60, ' '); | ||
$msg2End = $tortPurcent == 100 ? Console::text(' 🏆 WINNER!!!', 'green') : ''; | ||
|
||
Console::overwrite([$msg1,' ', $msg2.$msg2End,' ', $msg3, ' ']); | ||
|
||
// wait a moment, so we see the animation | ||
usleep(90000); | ||
} | ||
|
||
|
||
|
||
|
||
|
||
?> |
Oops, something went wrong.