Changeset View
Changeset View
Standalone View
Standalone View
src/toolset/workflow/ArcanistShellCompleteWorkflow.php
| Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | if ($should_install || $should_generate) { | ||||
| 'You may need to open a new terminal window or launch a new shell '. | 'You may need to open a new terminal window or launch a new shell '. | ||||
| 'before the changes take effect.')); | 'before the changes take effect.')); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| $this->runAutocomplete(); | $this->runAutocomplete(); | ||||
| } | } | ||||
| protected function newPrompts() { | |||||
| return array( | |||||
| $this->newPrompt('arc.shell-complete.install') | |||||
| ->setDescription( | |||||
| pht( | |||||
| 'Confirms writing to to "~/.profile" (or another similar file) '. | |||||
| 'to install shell completion.')), | |||||
| ); | |||||
| } | |||||
| private function runInstall() { | private function runInstall() { | ||||
| $log = $this->getLogEngine(); | $log = $this->getLogEngine(); | ||||
| $shells = array( | $shells = array( | ||||
| array( | array( | ||||
| 'key' => 'bash', | 'key' => 'bash', | ||||
| 'path' => '/bin/bash', | 'path' => '/bin/bash', | ||||
| 'file' => '.profile', | 'file' => '.profile', | ||||
| ▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | if ($replace) { | ||||
| $shell, | $shell, | ||||
| $file_display), | $file_display), | ||||
| $line); | $line); | ||||
| $prompt = pht('Append to this file?'); | $prompt = pht('Append to this file?'); | ||||
| } | } | ||||
| } | } | ||||
| // TOOLSETS: Generalize prompting. | $this->getPrompt('arc.shell-complete.install') | ||||
| ->setQuery($prompt) | |||||
| if (!phutil_console_confirm($prompt, false)) { | ->execute(); | ||||
| throw new PhutilArgumentUsageException(pht('Aborted.')); | |||||
| } | |||||
| Filesystem::writeFile($file_path, $new_data); | Filesystem::writeFile($file_path, $new_data); | ||||
| $log->writeSuccess( | $log->writeSuccess( | ||||
| pht('INSTALLED'), | pht('INSTALLED'), | ||||
| pht( | pht( | ||||
| 'Installed shell completion support for "%s" to "%s".', | 'Installed shell completion support for "%s" to "%s".', | ||||
| $shell, | $shell, | ||||
| ▲ Show 20 Lines • Show All 342 Lines • Show Last 20 Lines | |||||