-
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.
- Loading branch information
Showing
24 changed files
with
472 additions
and
423 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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,38 +1,32 @@ | ||
<?php | ||
|
||
require_once __DIR__ .'/../vendor/autoload.php'; | ||
use Kristuff\Mishell\Console; | ||
|
||
Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); | ||
Console::log(" - Use " . Console::text("int|bool ", 'blue') . Console::text("Console::askInt()", 'lightblue', 'underlined') . " to ask user to enter a number in the console."); | ||
Console::log(); | ||
Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); | ||
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."); | ||
Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); | ||
Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . | ||
' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); | ||
Console::log(); | ||
Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); | ||
Console::log(' ' . Console::text("\$value = Console::askInt('Please enter a number > ');", 'lightmagenta')); | ||
Console::log(' ' . Console::text("if (\$value !== false) {", 'lightmagenta')); | ||
Console::log(' ' . Console::text("// Do something with \$value", 'green')); | ||
Console::log(); | ||
Console::log(' '. Console::text('Sample:', 'underlined', 'bold')); | ||
|
||
Console::log('Overview:', 'underline', 'bold'); | ||
Console::log(" - Use " . Console::text("Console::askInt(\$str [\$styles])", 'blue', 'white') . " to ask user to enter a number in the console."); | ||
Console::log(''); | ||
Console::log('Tips:', 'underline', 'bold'); | ||
Console::log(" - The method returns Int value or False if the entered value is not a valid int number.", 'lightmagenta'); | ||
Console::log(" - You can customize colors (foreground and background) and some styles in same way than with Console::text()", 'lightmagenta'); | ||
Console::log(" and Console::log() methods..", 'lightmagenta'); | ||
Console::log(''); | ||
Console::log('Usage:', 'underline', 'bold'); | ||
Console::log(' ' . Console::text(Console::pad("\$value = Console::askInt('Please enter a number > ');", 80), 'blue', 'white')); | ||
Console::log(' ' . Console::text(Console::pad("if (\$value !== false) {", 80), 'blue', 'white')); | ||
Console::log(' ' . Console::text(Console::pad(" [...]", 80), 'blue', 'white')); | ||
Console::log(''); | ||
Console::log('Sample:', 'underline', 'bold'); | ||
|
||
function askNumber() | ||
{ | ||
$value = Console::askInt('Please enter a number > '); | ||
|
||
if ($value !== false){ | ||
Console::log('=> The value you entered is [' . Console::text($value, 'yellow') . ']'); | ||
|
||
} else { | ||
Console::log(Console::text('Error:', 'red')); | ||
Console::log(Console::text('=> the value you entered is not a valid number.', 'red')); | ||
// retry... | ||
askNumber(); | ||
} | ||
// ----------------- | ||
// sample start here | ||
// ----------------- | ||
$value = Console::askInt(' Please enter a number > '); | ||
if ($value !== false){ | ||
Console::log(' => The value you entered is [' . Console::text($value, 'yellow') . ']'); | ||
} else { | ||
Console::log(Console::text(' Error:', 'red')); | ||
Console::log(Console::text(' => the value you entered is not a valid number.', 'red')); | ||
} | ||
|
||
// ask | ||
askNumber(); | ||
?> |
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,24 +1,30 @@ | ||
<?php | ||
|
||
require_once __DIR__ .'/../vendor/autoload.php'; | ||
use Kristuff\Mishell\Console; | ||
|
||
Console::log('Overview:', 'underline', 'bold'); | ||
Console::log(" Use " . Console::text("Console::askPassword(\$str [\$styles])", 'blue', 'white') . " to ask user to enter a value and return this value.", 'white'); | ||
Console::log(''); | ||
Console::log('Tips:', 'underline', 'bold'); | ||
Console::log(" - you can customize colors (foreground and background) and some styles in same way than with Console::text()", 'green'); | ||
Console::log(" and Console::log() methods.", 'green'); | ||
Console::log(''); | ||
Console::log('Warning:', 'underline', 'bold'); | ||
Console::log(" - User input are not hidden on windows platform (not supported)", 'red', 'yellow'); | ||
Console::log(''); | ||
Console::log('Usage:', 'underline', 'bold'); | ||
Console::log(' ' . Console::text(Console::pad("\$value = Console::askPassword('Please Enter something (We wont display it, for now...) > ');", 80), 'blue', 'white')); | ||
Console::log(' ' . Console::text(Console::pad("Console::log();", 80), 'blue', 'white')); | ||
Console::log(' ' . Console::text(Console::pad("Console::log('=> the value you entered is [' . Console::text(\$value, 'red') . ']');", 80), 'blue', 'white')); | ||
Console::log(''); | ||
Console::log('Sample:', 'underline', 'bold'); | ||
$value = Console::askPassword('Please Enter something (We wont display it, for now...) > '); | ||
Console::log(' '. Console::text('Overview:', 'underlined', 'bold')); | ||
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'); | ||
Console::log(); | ||
Console::log(' '. Console::text('Tips:', 'underlined', 'bold')); | ||
Console::log(" - You can customize colors (foreground and background) and some styles in same way than "); | ||
Console::log(' with ' . Console::text("Console::text()", 'lightblue', 'underlined') . | ||
' and ' . Console::text("Console::log()", 'lightblue', 'underlined'). ' methods.'); | ||
Console::log(); | ||
Console::log(' '. Console::text('Warning:', 'underlined', 'bold')); | ||
Console::log(' '. Console::text("User input are not hidden on windows platform (not supported)", 'red', 'yellow')); | ||
Console::log(); | ||
Console::log(' '. Console::text('Usage:', 'underlined', 'bold')); | ||
Console::log(' ' . Console::text("\$value = Console::askPassword('Please Enter something (We wont display it, for now...) > ');", 'lightmagenta')); | ||
Console::log(' ' . Console::text("Console::log();", 'lightmagenta')); | ||
Console::log(' ' . Console::text("Console::log('=> the value you entered is [' . Console::text(\$value, 'red') . ']');", 'lightmagenta')); | ||
Console::log(); | ||
Console::log('=> the value you entered is [' . Console::text($value, 'red') . ']'); | ||
Console::log(' '. Console::text('Sample:', 'underlined', 'bold')); | ||
|
||
// ----------------- | ||
// sample start here | ||
// ----------------- | ||
$value = Console::askPassword(' Please Enter something (We wont display it, for now... (except on windows) > '); | ||
Console::log(); | ||
Console::log(' => the value you entered is [' . Console::text($value, 'red') . ']'); | ||
|
||
?> |
Oops, something went wrong.