From 0e8247400713812cdc661ea97479fb2404d0b7bd Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 4 Jun 2020 09:40:43 -0700 Subject: [PATCH] Support appending arbitrary lines to DisplayRef output Summary: Ref T13546. Several substeps in the new "arc land" flow benefit from this. For example: - When prompting "land revisions you don't own?", it's used to show authors. - When prompting "land revisions in the wrong state?", it's used to show the current states. Test Plan: Ran future "arc land" workflows, got relevant contextual information via this mechanism. Maniphest Tasks: T13546 Differential Revision: https://secure.phabricator.com/D21308 --- src/ref/ArcanistDisplayRef.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ref/ArcanistDisplayRef.php b/src/ref/ArcanistDisplayRef.php index c4e7a5d5..631b65b4 100644 --- a/src/ref/ArcanistDisplayRef.php +++ b/src/ref/ArcanistDisplayRef.php @@ -7,6 +7,7 @@ final class ArcanistDisplayRef private $ref; private $uri; + private $lines = array(); public function setRef(ArcanistRef $ref) { $this->ref = $ref; @@ -26,6 +27,11 @@ final class ArcanistDisplayRef return $this->uri; } + public function appendLine($line) { + $this->lines[] = $line; + return $this; + } + public function newTerminalString() { $ref = $this->getRef(); @@ -83,6 +89,10 @@ final class ArcanistDisplayRef $uri); } + foreach ($this->lines as $line) { + $output[] = tsprintf(" %s\n", $line); + } + return $output; }