Updated commands to reflect that we do support --no-interaction flag.
This commit is contained in:
@@ -67,7 +67,7 @@ final class Parity
|
||||
$total = (int)$stmt->fetchColumn();
|
||||
|
||||
$lastPage = @ceil($total / $perpage);
|
||||
if ($page > $lastPage) {
|
||||
if ($total && $page > $lastPage) {
|
||||
return api_error(r("Invalid page number. '{page}' is higher than what the last page is '{last_page}'.", [
|
||||
'page' => $page,
|
||||
'last_page' => $lastPage,
|
||||
|
||||
@@ -50,7 +50,7 @@ final class DeleteCommand extends Command
|
||||
|
||||
This command allows you to delete local backend data from the database.
|
||||
|
||||
This command require <notice>interaction</notice> to work. to bypass the check use <flag>--no-interaction</flag> flag.
|
||||
This command require <notice>interaction</notice> to work. to bypass the check use <flag>[-n, --no-interaction]</flag> flag.
|
||||
|
||||
This command will do the following:
|
||||
|
||||
|
||||
@@ -204,6 +204,8 @@ final class ListCommand extends Command
|
||||
|
||||
{cmd} <cmd>{route}</cmd> <flag>--parent</flag> <value>tvdb://269586</value> <flag>--mark-as</flag> <value>played</value>
|
||||
|
||||
This flag require <notice>interaction</notice> to work. to bypass the check use <flag>[-n, --no-interaction]</flag> flag.
|
||||
|
||||
HELP,
|
||||
[
|
||||
'cmd' => trim(commandContext()),
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Libs\HTTP_STATUS;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
|
||||
/**
|
||||
* Class ParityCommand
|
||||
@@ -76,6 +77,7 @@ final class ParityCommand extends Command
|
||||
{cmd} <cmd>{route}</cmd> <flag>--min</flag> <value>3</value> <flag>--prune</flag>
|
||||
|
||||
Warning, this command will delete the entire match, not limited by <flag>--limit</flag> flag.
|
||||
This flag require <notice>interaction</notice> to work. to bypass the check use <flag>[-n, --no-interaction]</flag> flag.
|
||||
|
||||
HELP,
|
||||
[
|
||||
@@ -127,6 +129,51 @@ final class ParityCommand extends Command
|
||||
}
|
||||
|
||||
if (true === $prune) {
|
||||
if (!$input->getOption('no-interaction')) {
|
||||
$paging = ag($response->body, 'paging', []);
|
||||
$tty = !(function_exists('stream_isatty') && defined('STDERR')) || stream_isatty(STDERR);
|
||||
if (false === $tty || $input->getOption('no-interaction')) {
|
||||
$output->writeln(
|
||||
r(
|
||||
<<<ERROR
|
||||
<error>ERROR:</error> This command require <notice>interaction</notice>. For example:
|
||||
{cmd} <cmd>{route}</cmd> <flag>--prune</flag>
|
||||
ERROR,
|
||||
[
|
||||
'cmd' => trim(commandContext()),
|
||||
'route' => self::ROUTE,
|
||||
]
|
||||
)
|
||||
);
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$helper = $this->getHelper('question');
|
||||
|
||||
$question = new ConfirmationQuestion(
|
||||
r(
|
||||
<<<HELP
|
||||
<question>Are you sure you want to delete [<value>{count}</value>] records from database</question>? {default}
|
||||
------------------
|
||||
<notice>NOTICE:</notice> You would have to re-import the records using [<cmd>state:import</cmd>] command.
|
||||
------------------
|
||||
<notice>For more information please read the FAQ.</notice>
|
||||
HELP. PHP_EOL . '> ',
|
||||
[
|
||||
'count' => ag($paging, 'total', 0),
|
||||
'cmd' => trim(commandContext()),
|
||||
'default' => '[<value>Y|N</value>] [<value>Default: No</value>]',
|
||||
]
|
||||
),
|
||||
false,
|
||||
);
|
||||
|
||||
if (true !== $helper->ask($input, $output, $question)) {
|
||||
$output->writeln('<info>Pruning aborted.</info>');
|
||||
return self::SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
$response = APIRequest('DELETE', '/system/parity/', opts: ['query' => ['min' => $min]]);
|
||||
|
||||
if (HTTP_STATUS::HTTP_OK !== $response->status) {
|
||||
|
||||
@@ -103,10 +103,11 @@ final class LogsCommand extends Command
|
||||
|
||||
<question># How to clear log file?</question>
|
||||
|
||||
You can clear log file by running this command, However clearing log file require interactive confirmation.
|
||||
|
||||
{cmd} <cmd>{route}</cmd> <flag>--type</flag> <value>{defaultLog}</value> <flag>--date</flag> <value>{defaultDate}</value> <flag>--clear</flag>
|
||||
|
||||
You can clear log file by running this command, However clearing log file require <notice>interaction</notice>.
|
||||
To bypass the check use <flag>[-n, --no-interaction]</flag> flag.
|
||||
|
||||
<question># How to increase/decrease the returned log lines?</question>
|
||||
|
||||
By default, we return the last [<value>{defaultLimit}</value>] log lines. However, you can increase/decrease
|
||||
|
||||
Reference in New Issue
Block a user