36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
		
		
			
		
	
	
			36 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| 
								 | 
							
								<?php
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								namespace SparkPlug\Com\Noccy\ApiClient\Commands;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								use Spark\Commands\Command;
							 | 
						||
| 
								 | 
							
								use SparkPlug;
							 | 
						||
| 
								 | 
							
								use SparkPlug\Com\Noccy\ApiClient\Api\Method;
							 | 
						||
| 
								 | 
							
								use SparkPlug\Com\Noccy\ApiClient\ApiClientPlugin;
							 | 
						||
| 
								 | 
							
								use SparkPlug\Com\Noccy\ApiClient\Request\RequestBuilder;
							 | 
						||
| 
								 | 
							
								use Symfony\Component\Console\Helper\Table;
							 | 
						||
| 
								 | 
							
								use Symfony\Component\Console\Input\InputArgument;
							 | 
						||
| 
								 | 
							
								use Symfony\Component\Console\Input\InputInterface;
							 | 
						||
| 
								 | 
							
								use Symfony\Component\Console\Input\InputOption;
							 | 
						||
| 
								 | 
							
								use Symfony\Component\Console\Output\OutputInterface;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class ApiLogsCommand extends Command
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    protected function configure()
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        $this->setName("api:logs")
							 | 
						||
| 
								 | 
							
								            ->setDescription("Show previous requests and manage the log")
							 | 
						||
| 
								 | 
							
								            ->addOption("clear", null, InputOption::VALUE_NONE, "Clear the log")
							 | 
						||
| 
								 | 
							
								            ->addOption("write", "w", InputOption::VALUE_REQUIRED, "Write the formatted entries to a file")
							 | 
						||
| 
								 | 
							
								            ;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    protected function execute(InputInterface $input, OutputInterface $output)
							 | 
						||
| 
								 | 
							
								    {
							 | 
						||
| 
								 | 
							
								        /** @var ApiClientPlugin */
							 | 
						||
| 
								 | 
							
								        $plugin = get_plugin('com.noccy.apiclient');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								        return Command::SUCCESS;
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								}
							 |