cleanup: Commands are a lot less verbal and report better on success / failue

This commit is contained in:
James Cole
2023-06-02 07:36:17 +02:00
parent 1e1497ff4e
commit dcf71c6fdf
60 changed files with 1108 additions and 1698 deletions

View File

@@ -31,18 +31,8 @@ use Illuminate\Console\Command;
*/
class RenameMetaFields extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Rename changed meta fields.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly-iii:rename-meta-fields';
protected $signature = 'firefly-iii:rename-meta-fields';
private int $count;
@@ -54,7 +44,6 @@ class RenameMetaFields extends Command
public function handle(): int
{
$this->count = 0;
$start = microtime(true);
$changes = [
'original-source' => 'original_source',
@@ -74,15 +63,11 @@ class RenameMetaFields extends Command
$this->rename($original, $update);
}
if (0 === $this->count) {
$this->line('All meta fields are correct.');
$this->info('Correct: all meta fields are correct.');
}
if (0 !== $this->count) {
$this->line(sprintf('Renamed %d meta field(s).', $this->count));
$this->info(sprintf('Renamed %d meta field(s).', $this->count));
}
$end = round(microtime(true) - $start, 2);
$this->info(sprintf('Renamed meta fields in %s seconds', $end));
return 0;
}