Commit 7cc44f02 authored by Marco Schmiedel's avatar Marco Schmiedel

beautified some scripts...

parent 345f746c
<?php <?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()
{
/*
|------------------------------------------------------------------------------------------------
| Information
|------------------------------------------------------------------------------------------------
|
| This file is beautified by the command "sidekick:CodebeautifierCommand" of the ceetrox
| sidekick package.
|
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Date: 2021-12-20 15:08:24
|
*/
namespace Ceetrox\Commands\BashColorDemoCommand;
/*
|------------------------------------------------------------------------------------------------
| Dependencies
|------------------------------------------------------------------------------------------------
*/
use Ceetrox\Managers\TerminalManager\TerminalManager;
use Illuminate\Console\Command;
/*
|------------------------------------------------------------------------------------------------
| Class "BashColorDemoCommand"
|------------------------------------------------------------------------------------------------
*/
class BashColorDemoCommand extends Command
{
/*
|--------------------------------------------------------------------------------------------
| Method "__construct"
|--------------------------------------------------------------------------------------------
*/
public function __construct()
{
$this->signature = 'sidekick:BashColorDemoCommand'; $this->signature = 'sidekick:BashColorDemoCommand';
$this->description = TerminalManager::brightBlue("This command returns all available colors of the terminal manager."); $this->description = TerminalManager::brightBlue("This command returns all available colors of the terminal manager.");
parent::__construct(); parent::__construct();
} }
/*
|--------------------------------------------------------------------------------------------
| Method "handle"
|--------------------------------------------------------------------------------------------
*/
public function handle() public function handle()
{ {
$this->info( TerminalManager::demo() ); $this->info( TerminalManager::demo() );
} }
} }
<?php
/*
|------------------------------------------------------------------------------------------------
| Information
|------------------------------------------------------------------------------------------------
|
| This file is beautified by the command "sidekick:CodebeautifierCommand" of the ceetrox
| sidekick package.
|
| Author: %author%
| Date: %timestasmp%
|
*/
%namespace%
/*
|------------------------------------------------------------------------------------------------
| Dependencies
|------------------------------------------------------------------------------------------------
*/
%relations%
%classes%
<?php <?php
/* ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ *\
|◦ Namespaces /*
\* ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ */ |------------------------------------------------------------------------------------------------
| Information
|------------------------------------------------------------------------------------------------
|
| This file is beautified by the command "sidekick:CodebeautifierCommand" of the ceetrox
| sidekick package.
|
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Date: 2021-12-20 15:21:14
|
*/
namespace Ceetrox\Managers\TerminalManager; namespace Ceetrox\Managers\TerminalManager;
/* ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ ◦ */ /*
class TerminalManager |------------------------------------------------------------------------------------------------
| Dependencies
|------------------------------------------------------------------------------------------------
*/
/*
|------------------------------------------------------------------------------------------------
| Class "TerminalManager"
|------------------------------------------------------------------------------------------------
*/
class TerminalManager
{ {
/*
|--------------------------------------------------------------------------------------------
| Method "brightBlue"
|--------------------------------------------------------------------------------------------
*/
static function brightBlue($text) static function brightBlue($text)
{ {
return TerminalManager::brightColor($text, 33); return TerminalManager::brightColor($text, 33);
} }
/*
|--------------------------------------------------------------------------------------------
| Method "darkColor"
|--------------------------------------------------------------------------------------------
| This method generates the dark color palette.
*/
static function darkColor($text, $color) static function darkColor($text, $color)
{ {
return "\e[0m"."\e[48;5;234m"."\e[38;5;".$color."m". $text . "\e[0m" ; return "\e[0m"."\e[48;5;234m"."\e[38;5;".$color."m". $text . "\e[0m" ;
} }
/*
|--------------------------------------------------------------------------------------------
| Method "brightColor"
|--------------------------------------------------------------------------------------------
| This method generates the bright color palette.
*/
static function brightColor($text, $color) static function brightColor($text, $color)
{ {
return "\e[0m"."\e[38;5;16m"."\e[48;5;".$color."m". $text . "\e[0m" ; return "\e[0m"."\e[38;5;16m"."\e[48;5;".$color."m". $text . "\e[0m" ;
} }
/*
|--------------------------------------------------------------------------------------------
| Method "demo"
|--------------------------------------------------------------------------------------------
| This method generates all available terminal colors for a demo output.
*/
static function demo() static function demo()
{ {
/*
|----------------------------------------------------------------------------------------
| Create an empty string for all upcoming colors...
*/
$text = "\n"; $text = "\n";
/*
|----------------------------------------------------------------------------------------
| Create counter value...
*/
$i1=16; $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"; /*
|----------------------------------------------------------------------------------------
| Loop counter value within the color range...
*/
while ( $i1 < 52 )
{
/*
|------------------------------------------------------------------------------------
| Calculate 7 columns per line...
*/
$i1=$i1;
$i2=$i1+36;
$i3=$i2+36;
$i4=$i3+36;
$i5=$i4+36;
$i6=$i5+36;
$i7=$i6+36;
if ( $i7 > 250 ) { $i7 = $i7-251; }
/*
|------------------------------------------------------------------------------------
| Calculate for bright and dark...
*/
$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);
/*
|------------------------------------------------------------------------------------
| Add linebreak...
*/
$text .= "\n";
/*
|------------------------------------------------------------------------------------
| Add value to counter...
*/
$i1 += 1;
}
return $text;
$i1 += 1;
}
return $text;
} }
}
}
<?php <?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 |------------------------------------------------------------------------------------------------
{ | Information
public function register() |------------------------------------------------------------------------------------------------
|
| This file is beautified by the command "sidekick:CodebeautifierCommand" of the ceetrox
| sidekick package.
|
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Date: 2021-12-20 15:22:21
|
*/
namespace Ceetrox\Providers\CommandServiceProvider;
/*
|------------------------------------------------------------------------------------------------
| Dependencies
|------------------------------------------------------------------------------------------------
*/
use Illuminate\Support\ServiceProvider;
/*
|------------------------------------------------------------------------------------------------
| Class "CommandServiceProvider"
|------------------------------------------------------------------------------------------------
| This provider implements all artisan commands of sidekick and is triggered by the core
| provider.
*/
class CommandServiceProvider extends ServiceProvider
{ {
/*
|--------------------------------------------------------------------------------------------
| Method "register"
|--------------------------------------------------------------------------------------------
*/
public function register()
{
$this->commands('Ceetrox\Commands\CodebeautifierCommand\CodebeautifierCommand'); $this->commands('Ceetrox\Commands\CodebeautifierCommand\CodebeautifierCommand');
$this->commands('Ceetrox\Commands\BashColorDemoCommand\BashColorDemoCommand'); $this->commands('Ceetrox\Commands\BashColorDemoCommand\BashColorDemoCommand');
}
} }
}
<?php <?php
namespace Ceetrox\Providers;
use Illuminate\Support\ServiceProvider;
use Ceetrox\Providers\CommandServiceProvider\CommandServiceProvider;
/*
|------------------------------------------------------------------------------------------------
| Information
|------------------------------------------------------------------------------------------------
|
| This file is beautified by the command "sidekick:CodebeautifierCommand" of the ceetrox
| sidekick package.
|
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Date: 2021-12-20 15:21:50
|
*/
namespace Ceetrox\Providers;
// This provider implements the core system of sidekick.
class CoreServiceProvider extends ServiceProvider /*
{ |------------------------------------------------------------------------------------------------
public function register() | Dependencies
|------------------------------------------------------------------------------------------------
*/
use Ceetrox\Providers\CommandServiceProvider\CommandServiceProvider;
use Illuminate\Support\ServiceProvider;
/*
|------------------------------------------------------------------------------------------------
| Class "CoreServiceProvider"
|------------------------------------------------------------------------------------------------
| This provider implements the core system of sidekick.
*/
class CoreServiceProvider extends ServiceProvider
{ {
// Register the artisan command service provider.
app()->register( new CommandServiceProvider( app() ) ); /*
|--------------------------------------------------------------------------------------------
| Method "register"
|--------------------------------------------------------------------------------------------
*/
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