Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/fulltextsearch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2018-08-19 18:57:16 +0300
committerMaxence Lange <maxence@artificial-owl.com>2018-08-19 18:57:16 +0300
commitba93f948b703c395be85dcaf498216b2a65b29ad (patch)
tree512f34992e793996b904a37c60c4ccf79f8bcd65 /lib
parent0740de36d407ed36da07c615eea889a9b21a90d7 (diff)
multiple line error message
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Command/Index.php34
-rw-r--r--lib/Command/Live.php35
2 files changed, 57 insertions, 12 deletions
diff --git a/lib/Command/Index.php b/lib/Command/Index.php
index 117067b..5b49293 100644
--- a/lib/Command/Index.php
+++ b/lib/Command/Index.php
@@ -30,8 +30,8 @@ use Exception;
use OCA\FullTextSearch\Exceptions\TickDoesNotExistException;
use OCA\FullTextSearch\IFullTextSearchProvider;
use OCA\FullTextSearch\Model\ExtendedBase;
-use OCA\FullTextSearch\Model\IndexOptions;
use OCA\FullTextSearch\Model\Index as ModelIndex;
+use OCA\FullTextSearch\Model\IndexOptions;
use OCA\FullTextSearch\Model\Runner;
use OCA\FullTextSearch\Service\CliService;
use OCA\FullTextSearch\Service\IndexService;
@@ -44,6 +44,7 @@ use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Terminal;
class Index extends ExtendedBase {
@@ -69,8 +70,10 @@ class Index extends ExtendedBase {
const PANEL_STATUS_LINE_DOCUMENTS = '│ Progress: %documentLeft:6s%/%documentTotal% %progressStatus%';
// const PANEL_STATUS_LINE_DOCUMENTS_LEFT = '│ Document left:';
const PANEL_STATUS_LINE_ERRORS = '│ Error: <comment>%errorCurrent:6s%</comment>/<comment>%errorTotal%</comment>';
- const PANEL_STATUS_LINE_ERROR_MESSAGE = '│ Message: <comment>%errorMessage%</comment>';
const PANEL_STATUS_LINE_ERROR_EXCEPTION = '│ Exception: <comment>%errorException%</comment>';
+ const PANEL_STATUS_LINE_ERROR_MESSAGE1 = '│ Message: <comment>%errorMessageA%</comment>';
+ const PANEL_STATUS_LINE_ERROR_MESSAGE2 = '│ <comment>%errorMessageB%</comment>';
+ const PANEL_STATUS_LINE_ERROR_MESSAGE3 = '│ <comment>%errorMessageC%</comment>';
const PANEL_STATUS_LINE_ERROR_INDEX = '│ Index: <comment>%errorIndex%</comment>';
@@ -112,6 +115,9 @@ class Index extends ExtendedBase {
/** @var Runner */
private $runner;
+ /** @var Terminal */
+ private $terminal;
+
/** @var array */
private $errors = [];
@@ -185,6 +191,8 @@ class Index extends ExtendedBase {
);
stream_set_blocking(STDIN, false);
+ $this->terminal = new Terminal();
+
$outputStyle = new OutputFormatterStyle('white', 'black', ['bold']);
$output->getFormatter()
->setStyle('char', $outputStyle);
@@ -447,8 +455,10 @@ class Index extends ExtendedBase {
self::PANEL_STATUS_LINE_HEADER,
self::PANEL_STATUS_LINE_DOCUMENTS,
self::PANEL_STATUS_LINE_ERRORS,
- self::PANEL_STATUS_LINE_ERROR_MESSAGE,
self::PANEL_STATUS_LINE_ERROR_EXCEPTION,
+ self::PANEL_STATUS_LINE_ERROR_MESSAGE1,
+ self::PANEL_STATUS_LINE_ERROR_MESSAGE2,
+ self::PANEL_STATUS_LINE_ERROR_MESSAGE3,
self::PANEL_STATUS_LINE_ERROR_INDEX,
self::PANEL_STATUS_LINE_FOOTER,
]
@@ -502,7 +512,9 @@ class Index extends ExtendedBase {
'progressStatus' => '',
'errorCurrent' => '0',
'errorTotal' => '0',
- 'errorMessage' => '',
+ 'errorMessageA' => '',
+ 'errorMessageB' => '',
+ 'errorMessageC' => '',
'errorException' => '',
'errorIndex' => ''
]
@@ -542,11 +554,19 @@ class Index extends ExtendedBase {
$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
}
+ $width = $this->terminal->getWidth() - 13;
+ $message = MiscService::get('message', $error, '');
+ $err1 = substr($message, 0, $width);
+ $err2 = substr($message, $width, $width + 10);
+ $err3 = substr($message, $width + $width + 10, $width + 10);
+
$this->runner->setInfoArray(
[
'errorCurrent' => $current,
'errorTotal' => $total,
- 'errorMessage' => MiscService::get('message', $error, ''),
+ 'errorMessageA' => trim($err1),
+ 'errorMessageB' => trim($err2),
+ 'errorMessageC' => trim($err3),
'errorException' => MiscService::get('exception', $error, ''),
'errorIndex' => $errorIndex
]
@@ -627,7 +647,9 @@ class Index extends ExtendedBase {
$this->runner->setInfoArray(
[
- 'errorMessage' => '',
+ 'errorMessageA' => '',
+ 'errorMessageB' => '',
+ 'errorMessageC' => '',
'errorException' => '',
'errorIndex' => ''
]
diff --git a/lib/Command/Live.php b/lib/Command/Live.php
index 266eec1..abd19e5 100644
--- a/lib/Command/Live.php
+++ b/lib/Command/Live.php
@@ -43,6 +43,7 @@ use OCP\IUserManager;
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
+use Symfony\Component\Console\Terminal;
class Live extends ExtendedBase {
@@ -68,8 +69,10 @@ class Live extends ExtendedBase {
const PANEL_STATUS_LINE_DOCUMENTS = '│ Progress: %documentLeft:6s%/%documentTotal% %progressStatus%';
// const PANEL_STATUS_LINE_DOCUMENTS_LEFT = '│ Document left:';
const PANEL_STATUS_LINE_ERRORS = '│ Error: <comment>%errorCurrent:6s%</comment>/<comment>%errorTotal%</comment>';
- const PANEL_STATUS_LINE_ERROR_MESSAGE = '│ Message: <comment>%errorMessage%</comment>';
const PANEL_STATUS_LINE_ERROR_EXCEPTION = '│ Exception: <comment>%errorException%</comment>';
+ const PANEL_STATUS_LINE_ERROR_MESSAGE1 = '│ Message: <comment>%errorMessageA%</comment>';
+ const PANEL_STATUS_LINE_ERROR_MESSAGE2 = '│ <comment>%errorMessageB%</comment>';
+ const PANEL_STATUS_LINE_ERROR_MESSAGE3 = '│ <comment>%errorMessageC%</comment>';
const PANEL_STATUS_LINE_ERROR_INDEX = '│ Index: <comment>%errorIndex%</comment>';
@@ -111,9 +114,12 @@ class Live extends ExtendedBase {
/** @var MiscService */
private $miscService;
+
/** @var Runner */
private $runner;
+ /** @var Terminal */
+ private $terminal;
/** @var array */
private $errors = [];
@@ -121,8 +127,9 @@ class Live extends ExtendedBase {
/** @var bool */
private $navigateLastError = true;
+
/**
- * Index constructor.
+ * Live constructor.
*
* @param IUserManager $userManager
* @param RunningService $runningService
@@ -181,6 +188,8 @@ class Live extends ExtendedBase {
);
stream_set_blocking(STDIN, false);
+ $this->terminal = new Terminal();
+
$outputStyle = new OutputFormatterStyle('white', 'black', ['bold']);
$output->getFormatter()
->setStyle('char', $outputStyle);
@@ -334,8 +343,10 @@ class Live extends ExtendedBase {
self::PANEL_STATUS_LINE_HEADER,
self::PANEL_STATUS_LINE_DOCUMENTS,
self::PANEL_STATUS_LINE_ERRORS,
- self::PANEL_STATUS_LINE_ERROR_MESSAGE,
self::PANEL_STATUS_LINE_ERROR_EXCEPTION,
+ self::PANEL_STATUS_LINE_ERROR_MESSAGE1,
+ self::PANEL_STATUS_LINE_ERROR_MESSAGE2,
+ self::PANEL_STATUS_LINE_ERROR_MESSAGE3,
self::PANEL_STATUS_LINE_ERROR_INDEX,
self::PANEL_STATUS_LINE_FOOTER,
]
@@ -389,7 +400,9 @@ class Live extends ExtendedBase {
'progressStatus' => '',
'errorCurrent' => '0',
'errorTotal' => '0',
- 'errorMessage' => '',
+ 'errorMessageA' => '',
+ 'errorMessageB' => '',
+ 'errorMessageC' => '',
'errorException' => '',
'errorIndex' => ''
]
@@ -451,11 +464,19 @@ class Live extends ExtendedBase {
$errorIndex = $index->getProviderId() . ':' . $index->getDocumentId();
}
+ $width = $this->terminal->getWidth() - 13;
+ $message = MiscService::get('message', $error, '');
+ $err1 = substr($message, 0, $width);
+ $err2 = substr($message, $width, $width + 10);
+ $err3 = substr($message, $width + $width + 10, $width + 10);
+
$this->runner->setInfoArray(
[
'errorCurrent' => $current,
'errorTotal' => $total,
- 'errorMessage' => MiscService::get('message', $error, ''),
+ 'errorMessageA' => trim($err1),
+ 'errorMessageB' => trim($err2),
+ 'errorMessageC' => trim($err3),
'errorException' => MiscService::get('exception', $error, ''),
'errorIndex' => $errorIndex
]
@@ -514,7 +535,9 @@ class Live extends ExtendedBase {
$this->runner->setInfoArray(
[
- 'errorMessage' => '',
+ 'errorMessageA' => '',
+ 'errorMessageB' => '',
+ 'errorMessageC' => '',
'errorException' => '',
'errorIndex' => ''
]