1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-26 00:32:41 +01:00

Wrap and simplify diff error excuse

Test Plan: Performed a lint error.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2802
This commit is contained in:
vrana 2012-06-19 18:14:26 -07:00
parent b2bb06ad0c
commit fa54b2ea27

View file

@ -1104,14 +1104,14 @@ EOTEXT
case ArcanistLintWorkflow::RESULT_WARNINGS: case ArcanistLintWorkflow::RESULT_WARNINGS:
$this->lintExcuse = $this->getErrorExcuse( $this->lintExcuse = $this->getErrorExcuse(
"Lint issued unresolved warnings.", "Lint issued unresolved warnings.",
$repository_api->getScratchFilePath('lint-excuses')); 'lint-excuses');
break; break;
case ArcanistLintWorkflow::RESULT_ERRORS: case ArcanistLintWorkflow::RESULT_ERRORS:
echo phutil_console_format( echo phutil_console_format(
"<bg:red>** LINT ERRORS **</bg> Lint raised errors!\n"); "<bg:red>** LINT ERRORS **</bg> Lint raised errors!\n");
$this->lintExcuse = $this->getErrorExcuse( $this->lintExcuse = $this->getErrorExcuse(
"Lint issued unresolved errors!", "Lint issued unresolved errors!",
$repository_api->getScratchFilePath('lint-excuses')); 'lint-excuses');
break; break;
} }
@ -1168,7 +1168,7 @@ EOTEXT
"<bg:red>** UNIT ERRORS **</bg> Unit testing raised errors!\n"); "<bg:red>** UNIT ERRORS **</bg> Unit testing raised errors!\n");
$this->unitExcuse = $this->getErrorExcuse( $this->unitExcuse = $this->getErrorExcuse(
"Unit test results include failures!", "Unit test results include failures!",
$repository_api->getScratchFilePath('unit-excuses')); 'unit-excuses');
break; break;
} }
@ -1184,7 +1184,7 @@ EOTEXT
return null; return null;
} }
private function getErrorExcuse($prompt, $history = '') { private function getErrorExcuse($prompt, $history) {
if ($this->getArgument('excuse')) { if ($this->getArgument('excuse')) {
$prompt .= " Ignore them?"; $prompt .= " Ignore them?";
if (!phutil_console_confirm($prompt)) { if (!phutil_console_confirm($prompt)) {
@ -1193,9 +1193,11 @@ EOTEXT
return $this->getArgument('excuse'); return $this->getArgument('excuse');
} }
$history = $this->getRepositoryAPI()->getScratchFilePath($history);
$prompt .= " Provide explanation to continue or press Enter to abort."; $prompt .= " Provide explanation to continue or press Enter to abort.";
echo "\n\n"; echo "\n\n";
echo phutil_console_format($prompt); echo phutil_console_wrap($prompt);
$return = phutil_console_prompt("Explanation:", $history); $return = phutil_console_prompt("Explanation:", $history);
if ($return == '') { if ($return == '') {
throw new ArcanistUserAbortException(); throw new ArcanistUserAbortException();