Commit 345f746c authored by Marco Schmiedel's avatar Marco Schmiedel

another late night backup for bash colors

parent 6e89aa83
<?php
namespace Ceetrox\Commands\BashColorDemoCommand;
use Illuminate\Console\Command;
use Ceetrox\Managers\TerminalManager\TerminalManager;
// This provider implements all artisan commands of sidekick and is triggered by the core provider.
class BashColorDemoCommand extends Command
{
public function __construct()
{
$this->signature = 'sidekick:BashColorDemoCommand';
$this->description = TerminalManager::brightBlue("This command returns all available colors of the terminal manager.");
parent::__construct();
}
public function handle()
{
$this->info( TerminalManager::demo() );
}
}
<?php
namespace Ceetrox\Commands\CodebeautifierCommand;
use Illuminate\Console\Command;
use Ceetrox\Managers\TerminalManager\TerminalManager;
// This provider implements all artisan commands of sidekick and is triggered by the core provider.
class CodebeautifierCommand extends Command
{
public function __construct()
{
$this->signature = 'sidekick:CodebeautifierCommand';
$this->description = TerminalManager::brightBlue("This command is a php code beautifier.");
parent::__construct();
}
public function handle()
{
$this->info( TerminalManager::demo() );
}
}
<?php
/* ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ *\
|◦ Namespaces
\* ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ */
namespace Ceetrox\Managers\TerminalManager;
/* ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ */
class TerminalManager
{
static function brightBlue($text)
{
return TerminalManager::brightColor($text, 33);
}
static function darkColor($text, $color)
{
return "\e[0m"."\e[48;5;234m"."\e[38;5;".$color."m". $text . "\e[0m" ;
}
static function brightColor($text, $color)
{
return "\e[0m"."\e[38;5;16m"."\e[48;5;".$color."m". $text . "\e[0m" ;
}
static function demo()
{
$text = "\n";
$i1=16;
while ( $i1 < 52 )
{
$i2=$i1+36;
$i3=$i2+36;
$i4=$i3+36;
$i5=$i4+36;
$i6=$i5+36;
$i7=$i6+36;
if ( $i7 > 250 ) { $i7 = $i7-251; }
$text .= TerminalManager::darkColor(" D".str_pad($i1, 3, "0", STR_PAD_LEFT)." ",$i1);
$text .= TerminalManager::darkColor(" D".str_pad($i2, 3, "0", STR_PAD_LEFT)." ",$i2);
$text .= TerminalManager::darkColor(" D".str_pad($i3, 3, "0", STR_PAD_LEFT)." ",$i3);
$text .= TerminalManager::darkColor(" D".str_pad($i4, 3, "0", STR_PAD_LEFT)." ",$i4);
$text .= TerminalManager::darkColor(" D".str_pad($i5, 3, "0", STR_PAD_LEFT)." ",$i5);
$text .= TerminalManager::darkColor(" D".str_pad($i6, 3, "0", STR_PAD_LEFT)." ",$i6);
$text .= TerminalManager::darkColor(" D".str_pad($i7, 3, "0", STR_PAD_LEFT)." ",$i7);
$text .= TerminalManager::brightColor(" B".str_pad($i1, 3, "0", STR_PAD_LEFT)." ",$i1);
$text .= TerminalManager::brightColor(" B".str_pad($i2, 3, "0", STR_PAD_LEFT)." ",$i2);
$text .= TerminalManager::brightColor(" B".str_pad($i3, 3, "0", STR_PAD_LEFT)." ",$i3);
$text .= TerminalManager::brightColor(" B".str_pad($i4, 3, "0", STR_PAD_LEFT)." ",$i4);
$text .= TerminalManager::brightColor(" B".str_pad($i5, 3, "0", STR_PAD_LEFT)." ",$i5);
$text .= TerminalManager::brightColor(" B".str_pad($i6, 3, "0", STR_PAD_LEFT)." ",$i6);
$text .= TerminalManager::brightColor(" B".str_pad($i7, 3, "0", STR_PAD_LEFT)." ",$i7);
$text .= "\n";
$i1 += 1;
}
return $text;
}
}
<?php
namespace Ceetrox\Providers;
class CommandServiceProvider
{
}
<?php
namespace Ceetrox\Providers\CommandServiceProvider;
use Illuminate\Support\ServiceProvider;
// This provider implements all artisan commands of sidekick and is triggered by the core provider.
class CommandServiceProvider extends ServiceProvider
{
public function register()
{
$this->commands('Ceetrox\Commands\CodebeautifierCommand\CodebeautifierCommand');
$this->commands('Ceetrox\Commands\BashColorDemoCommand\BashColorDemoCommand');
}
}
<?php
namespace Ceetrox\Providers;
use Illuminate\Support\ServiceProvider;
use Ceetrox\Providers\CommandServiceProvider\CommandServiceProvider;
class CoreServiceProvider
{
// This provider implements the core system of sidekick.
class CoreServiceProvider extends ServiceProvider
{
public function register()
{
// Register the artisan command service provider.
app()->register( new CommandServiceProvider( app() ) );
}
}
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