Remove config from git

Update packages
Add list command
This commit is contained in:
René Preuß
2024-06-21 22:19:21 +02:00
parent b4e617ee74
commit acedefd370
8 changed files with 654 additions and 70 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace App\Commands;
use LaravelZero\Framework\Commands\Command;
use Smalot\Cups\Builder\Builder;
use Smalot\Cups\Manager\PrinterManager;
use Smalot\Cups\Transport\Client;
use Smalot\Cups\Transport\ResponseParser;
class ListCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'printers';
/**
* The console command description.
*
* @var string
*/
protected $description = 'List all printers';
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
$client = new Client();
$builder = new Builder();
$responseParser = new ResponseParser();
$printerManager = new PrinterManager($builder, $client, $responseParser);
$printers = $printerManager->getList();
$this->info('Printers:');
foreach ($printers as $printer) {
$this->info($printer->getName());
}
return 0;
}
}