diff --git a/src/console/PhutilInteractiveEditor.php b/src/console/PhutilInteractiveEditor.php --- a/src/console/PhutilInteractiveEditor.php +++ b/src/console/PhutilInteractiveEditor.php @@ -22,6 +22,7 @@ private $offset = 0; private $preferred; private $fallback; + private $taskMessage; /* -( Creating a New Editor )---------------------------------------------- */ @@ -74,6 +75,20 @@ $editor = $this->getEditor(); $offset = $this->getLineOffset(); + $binary = basename($editor); + + // This message is primarily an assistance to users with GUI-based + // editors configured. Users with terminal-based editors won't have a + // chance to see this prior to the editor being launched. + echo tsprintf( + "%s\n", + pht('Launching editor "%s"...', $binary)); + + $task_message = $this->getTaskMessage(); + if ($task_message !== null) { + echo tsprintf("%s\n", $task_message); + } + $err = $this->invokeEditor($editor, $path, $offset); if ($err) { @@ -85,7 +100,6 @@ 'vim' => true, ); - $binary = basename($editor); if (isset($vi_binaries[$binary])) { // This runs "Q" (an invalid command), then "q" (a valid command, // meaning "quit"). Vim binaries with behavior that makes them poor @@ -266,6 +280,33 @@ return $this; } + /** + * Set the message that identifies the task for which the editor is being + * launched, displayed to the user prior to it being launched. + * + * @param string The message to display to the user. + * @return $this + * + * @task config + */ + public function setTaskMessage($task_message) { + $this->taskMessage = $task_message; + return $this; + } + + /** + * Retrieve the current message that will display to the user just prior to + * invoking the editor. + * + * @return string The message that will display to the user, or null if no + * message will be displayed. + * + * @task config + */ + public function getTaskMessage() { + return $this->taskMessage; + } + /** * Get the name of the editor program to use. The value of the environmental diff --git a/src/workflow/ArcanistDiffWorkflow.php b/src/workflow/ArcanistDiffWorkflow.php --- a/src/workflow/ArcanistDiffWorkflow.php +++ b/src/workflow/ArcanistDiffWorkflow.php @@ -674,6 +674,8 @@ if ($should_edit) { $edited = $this->newInteractiveEditor($remote_corpus) ->setName('differential-edit-revision-info') + ->setTaskMessage(pht( + 'Update the details for a revision, then save and exit.')) ->editInteractively(); if ($edited != $remote_corpus) { $remote_corpus = $edited; @@ -1476,6 +1478,8 @@ } else { $new_template = $this->newInteractiveEditor($template) ->setName('new-commit') + ->setTaskMessage(pht( + 'Provide the details for a new revision, then save and exit.')) ->editInteractively(); } $first = false; @@ -1752,6 +1756,8 @@ $comments = $this->newInteractiveEditor($template) ->setName('differential-update-comments') + ->setTaskMessage(pht( + 'Update the revision comments, then save and exit.')) ->editInteractively(); return $comments; diff --git a/src/workflow/ArcanistPatchWorkflow.php b/src/workflow/ArcanistPatchWorkflow.php --- a/src/workflow/ArcanistPatchWorkflow.php +++ b/src/workflow/ArcanistPatchWorkflow.php @@ -909,6 +909,8 @@ $commit_message = $this->newInteractiveEditor($template) ->setName('arcanist-patch-commit-message') + ->setTaskMessage(pht( + 'Supply a commit message for this patch, then save and exit.')) ->editInteractively(); $commit_message = ArcanistCommentRemover::removeComments($commit_message); diff --git a/src/workflow/ArcanistWorkflow.php b/src/workflow/ArcanistWorkflow.php --- a/src/workflow/ArcanistWorkflow.php +++ b/src/workflow/ArcanistWorkflow.php @@ -1234,6 +1234,9 @@ $commit_message = $this->newInteractiveEditor($template) ->setName(pht('commit-message')) + ->setTaskMessage(pht( + 'Supply commit message for uncommitted changes, then save and '. + 'exit.')) ->editInteractively(); if ($commit_message === $template) {