Commit 859de661 authored by Luke081515's avatar Luke081515

Add echo functions

parent 376cf28b
Pipeline #1401 passed with stages
in 1 minute and 47 seconds
#!/usr/bin/php
<?php
require './Cygnus/BotCore.php';
/** WikiCommander.php
* WikiCommander Tool, see https://gitlab.wmflabs.org/Luke/WikiCommander
* @Author Luke081515 <luke081515@tools.wmflabs.org>
* @Version 0.1
* @Status Alpha
*/
class WikiCommander extends Core {
public function __construct($Account, $Job, $pUseHTTPS = true) {
$this->initcurl($Account, $Job, $pUseHTTPS);
}
/** echoCritical
* Writes out a critical message
* Use this only for critical messages
* Prints out the message in red
*/
private function echoCritical($msg) {
echo "\n\033[01;31m" . $msg . "\033[0m";
}
/** echoSuccessful
* Use this only when a task was successful
* Prints out the message in green
*/
private function echoSuccessful($msg) {
echo "\n\033[01;32m" . $msg . "\033[0m";
}
/** echoWarning
* Writes out a warning
* Use this only for non-critical warnings
* Prints the message out in yellow
*/
private function echoWarning($msg) {
echo "\n\033[01;33m" . $msg . "\033[0m";
}
/** echoNotice
* Writes out a notice
* Use this only for notices, no output, no warnings/errors
* Prints the message out in blue
*/
private function echoNotice($msg) {
echo "\n\033[01;34m" . $msg . "\033[0m";
}
/** echoOutput
* Writes out the output of a function
* Use this only for function output
* Prints the message out in purple
*/
private function echoOutput($msg) {
if ($msg === true) {
echo "\n\033[01;35mReturned value: true\033[0m";
} else if ($msg === false) {
echo "\n\033[01;35mReturned value: false\033[0m";
} else if ($msg === null) {
echo "\n\033[01;35mReturned value: NULL\033[0m";
} else {
echo "\n\033[01;35m" . $msg . "\033[0m";
}
}
/** askRequired
* Asks for something
* Use this only if the answer is required
* Prints the answer in yellow
*/
private function askRequired($msg) {
return $this->askOperator("\n\033[01;33m" . $msg . "\033[0m");
}
/** askOptional
* Asks for something
* Use this only if the answer is optional (additional param for example)
* Prints the answer in cyan
*/
private function askOptional($msg) {
return $this->askOperator("\n\033[01;36m" . $msg . "\033[0m");
}
}
$Bot = new ExampleProgramm ('WikiCommander', 'WikiCommander');
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment