Not sure how you're triggering the call to 'php artisan generate', but can you do 'yes yes | php artisan generate' instead?
Console Command for Running Another Console
Hey All.
I'm building an app that needs API docs, so I've pulled in APIGEN and I'm building the docs with that. It works great running it from the terminal. But I ran into a situation with GitHub where I can only have 1000 documents in a given directory.
So, my thought is, since I'm using Envoyer to deploy, create a deply hook to run the command to build the docs after the deployment. So far so good.
BUT, the terminal requires user input and won't complete when I run the command from a hook, like so:
vincek$ php apigen generate
Scanning sources and parsing
Found 472 classes, 0 constants and 98 functions
Destination is not empty. Do you want to erase it? [yes]
I've looked all through the docs and there doesn't seem to be a way to negate that feedback, so I thought maybe I can build an artisan command that I could execute with --force or something that I could run from a hook to build my docs.
I have the basic scaffolding for this, but from the Laravel docs I'm not sure where to go next.
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
/**
* Local artisan command for building the API Docs.
*/
class BuildDocumentation extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'docs:build';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Build API documentation with ApiGen.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//
}
}
I'd appreciate any help or advice.
-Vince
Please or to participate in this conversation.