diff --git a/app/Commands/CreateAuthCommand.php b/app/Commands/CreateAuthCommand.php index 712a1af..d3ad5b1 100644 --- a/app/Commands/CreateAuthCommand.php +++ b/app/Commands/CreateAuthCommand.php @@ -34,7 +34,7 @@ class CreateAuthCommand extends Command public function handle(Config $config) : void { if (! $this->argument('name')) { - $this->input->setArgument('name', $this->ask('ENTER NAME')); + $this->input->setArgument('name', 'default'); } foreach (['auth', 'host'] as $option) { diff --git a/app/Commands/ListAlbumsCommand.php b/app/Commands/ListAlbumsCommand.php index 4b603b0..5149bd2 100644 --- a/app/Commands/ListAlbumsCommand.php +++ b/app/Commands/ListAlbumsCommand.php @@ -2,16 +2,11 @@ namespace App\Commands; -use App\Config\Config; use App\Exceptions\InvalidTokenException; use App\GPhoto; -use App\Listeners\TokenListener; -use Exception; use Google\ApiCore\ApiException; use Google\ApiCore\ValidationException; use Google\Photos\Types\Album; -use Illuminate\Support\Facades\Process; -use JetBrains\PhpStorm\NoReturn; use LaravelZero\Framework\Commands\Command; use Symfony\Component\Console\Input\InputOption; @@ -38,12 +33,11 @@ class ListAlbumsCommand extends Command */ public function handle() : void { - $auth = $this->option('auth'); - if (! $auth) { - $auth = 'default'; + if (! $this->option('auth')) { + $this->input->setOption('auth', 'default'); } - $gphoto = new GPhoto($auth); + $gphoto = new GPhoto($this->option('auth')); $response = $gphoto->client()->listAlbums([ 'excludeNonAppCreatedData' => true, diff --git a/app/Commands/ReloadAuthCommand.php b/app/Commands/ReloadAuthCommand.php index 3249f86..980bade 100644 --- a/app/Commands/ReloadAuthCommand.php +++ b/app/Commands/ReloadAuthCommand.php @@ -34,7 +34,7 @@ class ReloadAuthCommand extends Command public function handle() : void { if (! $this->argument('name')) { - $this->input->setArgument('name', $this->ask('ENTER NAME')); + $this->input->setArgument('name', 'default'); } $gphoto = new GPhoto($this->argument('name')); diff --git a/app/Commands/UploadAlbumCommand.php b/app/Commands/UploadAlbumCommand.php index c8e2bd5..5ca7d01 100644 --- a/app/Commands/UploadAlbumCommand.php +++ b/app/Commands/UploadAlbumCommand.php @@ -33,11 +33,15 @@ class UploadAlbumCommand extends Command */ public function handle() : void { + if (! $this->option('auth')) { + $this->input->setOption('auth', 'default'); + } + $gphoto = new GPhoto($this->option('auth')); if (! file_exists($gphoto->path('config.json'))) { $this->components->warn( - 'CONFIG NOT EXISTS run "gphoto token:create" instead' + 'CONFIG NOT EXISTS run "gphoto auth:create" instead' ); return; diff --git a/app/Commands/UploadPhotoCommand.php b/app/Commands/UploadPhotoCommand.php index c8e4b02..84fa85d 100644 --- a/app/Commands/UploadPhotoCommand.php +++ b/app/Commands/UploadPhotoCommand.php @@ -45,11 +45,15 @@ class UploadPhotoCommand extends Command */ public function handle() : void { + if (! $this->option('auth')) { + $this->input->setOption('auth', 'default'); + } + $gphoto = new GPhoto($this->option('auth')); if (! file_exists($gphoto->path('storage/token'))) { $this->components->error( - 'TOKEN NOT EXISTS run "gphoto token:create" instead' + 'TOKEN NOT EXISTS run "gphoto auth:create" instead' ); return;