Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F4985626
Masterwork From Distant Lands
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
alexmv
Jun 1 2017, 3:35 AM
2017-06-01 03:35:15 (UTC+0)
Size
2 KB
Referenced Files
None
Subscribers
None
Masterwork From Distant Lands
View Options
diff --git a/src/console/view/PhutilConsoleTable.php b/src/console/view/PhutilConsoleTable.php
index 7c29f99..d19141d 100644
--- a/src/console/view/PhutilConsoleTable.php
+++ b/src/console/view/PhutilConsoleTable.php
@@ -30,6 +30,7 @@ final class PhutilConsoleTable extends PhutilConsoleView {
private $borders = false;
private $padding = 1;
private $showHeader = true;
+ private $escape = true;
const ALIGN_LEFT = 'left';
const ALIGN_CENTER = 'center';
@@ -54,6 +55,11 @@ final class PhutilConsoleTable extends PhutilConsoleView {
return $this;
}
+ public function setEscapeContents($escape) {
+ $this->escape = $escape;
+ return $this;
+ }
+
/* -( Data )--------------------------------------------------------------- */
@@ -88,6 +94,16 @@ final class PhutilConsoleTable extends PhutilConsoleView {
/* -( Drawing )------------------------------------------------------------ */
+ public function drawConsoleString() {
+ if ($this->escape) {
+ return parent::drawConsoleString();
+ }
+
+ $view = $this->drawView();
+ $parts = $this->reduceView($view);
+ return implode('', $parts);
+ }
+
protected function drawView() {
return $this->drawLines(
array_merge(
diff --git a/src/console/view/PhutilConsoleView.php b/src/console/view/PhutilConsoleView.php
index 85f5b8f..96087ca 100644
--- a/src/console/view/PhutilConsoleView.php
+++ b/src/console/view/PhutilConsoleView.php
@@ -41,7 +41,7 @@ abstract class PhutilConsoleView extends Phobject {
* @return string Console-printable string.
* @task draw
*/
- final public function drawConsoleString() {
+ public function drawConsoleString() {
$view = $this->drawView();
$parts = $this->reduceView($view);
@@ -61,7 +61,7 @@ abstract class PhutilConsoleView extends Phobject {
* @return list<wild> List of unnested drawables.
* @task draw
*/
- private function reduceView($view) {
+ protected function reduceView($view) {
if ($view instanceof PhutilConsoleView) {
$view = $view->drawView();
return $this->reduceView($view);
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
673429
Default Alt Text
Masterwork From Distant Lands (2 KB)
Attached To
Mode
P2057 Masterwork From Distant Lands
Attached
Detach File
Event Timeline
Log In to Comment