Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistAliasWorkflow.php
| Show First 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | if (count($argv) == 0) { | ||||
| if ($aliases) { | if ($aliases) { | ||||
| foreach ($aliases as $alias => $binding) { | foreach ($aliases as $alias => $binding) { | ||||
| echo phutil_console_format( | echo phutil_console_format( | ||||
| "**%s** %s\n", | "**%s** %s\n", | ||||
| $alias, | $alias, | ||||
| implode(' ' , $binding)); | implode(' ' , $binding)); | ||||
| } | } | ||||
| } else { | } else { | ||||
| echo "You haven't defined any aliases yet.\n"; | echo pht("You haven't defined any aliases yet.")."\n"; | ||||
| } | } | ||||
| } else if (count($argv) == 1) { | } else if (count($argv) == 1) { | ||||
| if (empty($aliases[$argv[0]])) { | if (empty($aliases[$argv[0]])) { | ||||
| echo "No alias '{$argv[0]}' to remove.\n"; | echo pht("No alias '%s' to remove.", $argv[0])."\n"; | ||||
| } else { | } else { | ||||
| echo phutil_console_format( | echo pht( | ||||
| "'**arc %s**' is currently aliased to '**arc %s**'.", | "'%s' is currently aliased to '%s'.", | ||||
| $argv[0], | phutil_console_format('**arc %s**', $argv[0]), | ||||
| implode(' ', $aliases[$argv[0]])); | phutil_console_format( | ||||
| $ok = phutil_console_confirm('Delete this alias?'); | '**arc %s**', | ||||
| implode(' ', $aliases[$argv[0]]))); | |||||
| $ok = phutil_console_confirm(pht('Delete this alias?')); | |||||
| if ($ok) { | if ($ok) { | ||||
| $was = implode(' ', $aliases[$argv[0]]); | $was = implode(' ', $aliases[$argv[0]]); | ||||
| unset($aliases[$argv[0]]); | unset($aliases[$argv[0]]); | ||||
| $this->writeAliases($aliases); | $this->writeAliases($aliases); | ||||
| echo "Unaliased '{$argv[0]}' (was '{$was}').\n"; | echo pht("Unaliased '%s' (was '%s').", $argv[0], $was)."\n"; | ||||
| } else { | } else { | ||||
| throw new ArcanistUserAbortException(); | throw new ArcanistUserAbortException(); | ||||
| } | } | ||||
| } | } | ||||
| } else { | } else { | ||||
| $arc_config = $this->getArcanistConfiguration(); | $arc_config = $this->getArcanistConfiguration(); | ||||
| if ($arc_config->buildWorkflow($argv[0])) { | if ($arc_config->buildWorkflow($argv[0])) { | ||||
| throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
| "You can not create an alias for '{$argv[0]}' because it is a ". | pht( | ||||
| "builtin command. 'arc alias' can only create new commands."); | "You can not create an alias for '%s' because it is a ". | ||||
| "builtin command. '%s' can only create new commands.", | |||||
| $argv[0], | |||||
| 'arc alias')); | |||||
| } | } | ||||
| $aliases[$argv[0]] = array_slice($argv, 1); | $aliases[$argv[0]] = array_slice($argv, 1); | ||||
| echo phutil_console_format( | echo pht( | ||||
| "Aliased '**arc %s**' to '**arc %s**'.\n", | "Aliased '%s' to '%s'.\n", | ||||
| $argv[0], | phutil_console_format('**arc %s**', $argv[0]), | ||||
| implode(' ', $aliases[$argv[0]])); | phutil_console_format('**arc %s**', implode(' ', $aliases[$argv[0]]))); | ||||
| $this->writeAliases($aliases); | $this->writeAliases($aliases); | ||||
| } | } | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| public static function isShellCommandAlias($command) { | public static function isShellCommandAlias($command) { | ||||
| Show All 36 Lines | |||||