1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-16 22:44:04 +00:00

Improve commands CLI output (#1030)

* use component info/error methods

* Update src/Commands/ClearPendingTenants.php

Co-authored-by: lukinovec <lukinovec@gmail.com>

Co-authored-by: lukinovec <lukinovec@gmail.com>
This commit is contained in:
Abrar Ahmad 2022-12-14 19:08:00 +05:00 committed by GitHub
parent 7d3298c6bb
commit 68de3600bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View file

@ -17,7 +17,7 @@ class ClearPendingTenants extends Command
public function handle(): int
{
$this->info('Removing pending tenants.');
$this->components->info('Removing pending tenants.');
$expirationDate = now();
// We compare the original expiration date to the new one to check if the new one is different later
@ -27,8 +27,7 @@ class ClearPendingTenants extends Command
$olderThanHours = (int) $this->option('older-than-hours');
if ($olderThanDays && $olderThanHours) {
$this->line("<options=bold,reverse;fg=red> Cannot use '--older-than-days' and '--older-than-hours' together \n"); // todo@cli refactor all of these styled command outputs to use $this->components
$this->line('Please, choose only one of these options.');
$this->components->error("Cannot use '--older-than-days' and '--older-than-hours' together. Please, choose only one of these options.");
return 1; // Exit code for failure
}
@ -51,7 +50,7 @@ class ClearPendingTenants extends Command
->delete()
->count();
$this->info($deletedTenantCount . ' pending ' . str('tenant')->plural($deletedTenantCount) . ' deleted.');
$this->components->info($deletedTenantCount . ' pending ' . str('tenant')->plural($deletedTenantCount) . ' deleted.');
return 0;
}