1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 02:02:40 +01:00

phtize strings in ArcanistSettings

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D11610
This commit is contained in:
Joshua Spence 2015-02-03 06:54:46 +11:00
parent e4be031778
commit 0584d4a06f

View file

@ -6,38 +6,40 @@ final class ArcanistSettings {
return array( return array(
'default' => array( 'default' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
'The URI of a Phabricator install to connect to by default, if '. 'The URI of a Phabricator install to connect to by default, if '.
'arc is run in a project without a Phabricator URI or run outside '. '%s is run in a project without a Phabricator URI or run outside '.
'of a project.', 'of a project.',
'arc'),
'example' => '"http://phabricator.example.com/"', 'example' => '"http://phabricator.example.com/"',
), ),
'base' => array( 'base' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
'Base commit ruleset to invoke when determining the start of a '. 'Base commit ruleset to invoke when determining the start of a '.
'commit range. See "Arcanist User Guide: Commit Ranges" for '. 'commit range. See "Arcanist User Guide: Commit Ranges" for '.
'details.', 'details.'),
'example' => '"arc:amended, arc:prompt"', 'example' => '"arc:amended, arc:prompt"',
), ),
'load' => array( 'load' => array(
'type' => 'list', 'type' => 'list',
'legacy' => 'phutil_libraries', 'legacy' => 'phutil_libraries',
'help' => 'help' => pht(
'A list of paths to phutil libraries that should be loaded at '. 'A list of paths to phutil libraries that should be loaded at '.
'startup. This can be used to make classes available, like lint or '. 'startup. This can be used to make classes available, like lint '.
'unit test engines.', 'or unit test engines.'),
'example' => '["/var/arc/customlib/src"]',
'default' => array(), 'default' => array(),
'example' => '["/var/arc/customlib/src"]',
), ),
'repository.callsign' => array( 'repository.callsign' => array(
'type' => 'string', 'type' => 'string',
'example' => '"X"', 'example' => '"X"',
'help' => pht( 'help' => pht(
'Associate the working copy with a specific Phabricator repository. '. 'Associate the working copy with a specific Phabricator repository. '.
'Normally, arc can figure this association out on its own, but if '. 'Normally, %s can figure this association out on its own, but if '.
'your setup is unusual you can use this option to tell it what the '. 'your setup is unusual you can use this option to tell it what the '.
'desired value is.'), 'desired value is.',
'arc'),
), ),
'phabricator.uri' => array( 'phabricator.uri' => array(
'type' => 'string', 'type' => 'string',
@ -59,116 +61,122 @@ final class ArcanistSettings {
'lint.engine' => array( 'lint.engine' => array(
'type' => 'string', 'type' => 'string',
'legacy' => 'lint_engine', 'legacy' => 'lint_engine',
'help' => 'help' => pht(
'The name of a default lint engine to use, if no lint engine is '. 'The name of a default lint engine to use, if no lint engine is '.
'specified by the current project.', 'specified by the current project.'),
'example' => '"ExampleLintEngine"', 'example' => '"ExampleLintEngine"',
), ),
'unit.engine' => array( 'unit.engine' => array(
'type' => 'string', 'type' => 'string',
'legacy' => 'unit_engine', 'legacy' => 'unit_engine',
'help' => 'help' => pht(
'The name of a default unit test engine to use, if no unit test '. 'The name of a default unit test engine to use, if no unit test '.
'engine is specified by the current project.', 'engine is specified by the current project.'),
'example' => '"ExampleUnitTestEngine"', 'example' => '"ExampleUnitTestEngine"',
), ),
'arc.feature.start.default' => array( 'arc.feature.start.default' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
'The name of the default branch to create the new feature branch '. 'The name of the default branch to create the new feature branch '.
'off of.', 'off of.'),
'example' => '"develop"', 'example' => '"develop"',
), ),
'arc.land.onto.default' => array( 'arc.land.onto.default' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
'The name of the default branch to land changes onto when '. 'The name of the default branch to land changes onto when '.
'`arc land` is run.', '`%s` is run.',
'arc land'),
'example' => '"develop"', 'example' => '"develop"',
), ),
'arc.land.update.default' => array( 'arc.land.update.default' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
'The default strategy to use when arc land updates the feature '. 'The default strategy to use when arc land updates the feature '.
'branch. Supports \'rebase\' and \'merge\' strategies.', 'branch. Supports "rebase" and "merge" strategies.'),
'example' => '"rebase"', 'example' => '"rebase"',
), ),
'arc.lint.cache' => array( 'arc.lint.cache' => array(
'type' => 'bool', 'type' => 'bool',
'help' => 'help' => pht(
"Enable the lint cache by default. When enabled, 'arc lint' ". 'Enable the lint cache by default. When enabled, `%s` attempts to '.
"attempts to use cached results if possible. Currently, the cache ". 'use cached results if possible. Currently, the cache is not always '.
"is not always invalidated correctly and may cause 'arc lint' to ". 'invalidated correctly and may cause `%s` to report incorrect '.
"report incorrect results, particularly while developing linters. ". 'results, particularly while developing linters. This is probably '.
"This is probably worth enabling only if your linters are very slow.", 'worth enabling only if your linters are very slow.',
'example' => 'false', 'arc lint',
'arc lint'),
'default' => false, 'default' => false,
'example' => 'false',
), ),
'history.immutable' => array( 'history.immutable' => array(
'type' => 'bool', 'type' => 'bool',
'legacy' => 'immutable_history', 'legacy' => 'immutable_history',
'help' => 'help' => pht(
'If true, arc will never change repository history (e.g., through '. 'If true, %s will never change repository history (e.g., through '.
'amending or rebasing). Defaults to true in Mercurial and false in '. 'amending or rebasing). Defaults to true in Mercurial and false in '.
'Git. This setting has no effect in Subversion.', 'Git. This setting has no effect in Subversion.',
'arc'),
'example' => 'false', 'example' => 'false',
), ),
'editor' => array( 'editor' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
"Command to use to invoke an interactive editor, like 'nano' or ". 'Command to use to invoke an interactive editor, like `%s` or `%s`. '.
"'vim'. This setting overrides the EDITOR environmental variable.", 'This setting overrides the %s environmental variable.',
'nano',
'vim',
'EDITOR'),
'example' => '"nano"', 'example' => '"nano"',
), ),
'https.cabundle' => array( 'https.cabundle' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht(
"Path to a custom CA bundle file to be used for arcanist's cURL ". "Path to a custom CA bundle file to be used for arcanist's cURL ".
"calls. This is used primarily when your conduit endpoint is ". "calls. This is used primarily when your conduit endpoint is ".
"behind https signed by your organization's internal CA.", "behind HTTPS signed by your organization's internal CA."),
'example' => 'support/yourca.pem', 'example' => 'support/yourca.pem',
), ),
'https.blindly-trust-domains' => array( 'https.blindly-trust-domains' => array(
'type' => 'list', 'type' => 'list',
'help' => 'List of domains to blindly trust SSL certificates for. '. 'help' => pht(
'Disables peer verification.', 'List of domains to blindly trust SSL certificates for. '.
'example' => '["secure.mycompany.com"]', 'Disables peer verification.'),
'default' => array(), 'default' => array(),
'example' => '["secure.mycompany.com"]',
), ),
'browser' => array( 'browser' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht('Command to use to invoke a web browser.'),
'Command to use to invoke a web browser.',
'example' => '"gnome-www-browser"', 'example' => '"gnome-www-browser"',
), ),
'events.listeners' => array( 'events.listeners' => array(
'type' => 'list', 'type' => 'list',
'help' => 'List of event listener classes to install at startup.', 'help' => pht('List of event listener classes to install at startup.'),
'example' => '["ExampleEventListener"]',
'default' => array(), 'default' => array(),
'example' => '["ExampleEventListener"]',
), ),
'http.basicauth.user' => array( 'http.basicauth.user' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht('Username to use for basic auth over HTTP transports.'),
'Username to use for basic auth over http transports',
'example' => '"bob"', 'example' => '"bob"',
), ),
'http.basicauth.pass' => array( 'http.basicauth.pass' => array(
'type' => 'string', 'type' => 'string',
'help' => 'help' => pht('Password to use for basic auth over HTTP transports.'),
'Password to use for basic auth over http transports',
'example' => '"bobhasasecret"', 'example' => '"bobhasasecret"',
), ),
'arc.autostash' => array( 'arc.autostash' => array(
'type' => 'bool', 'type' => 'bool',
'help' => 'help' => pht(
'Whether arc should permit the automatic stashing of changes in '. 'Whether %s should permit the automatic stashing of changes in the '.
'the working directory when requiring a clean working copy. '. 'working directory when requiring a clean working copy. This option '.
'This option should only be used when users understand how '. 'should only be used when users understand how to restore their '.
'to restore their working directory from the local stash if '. 'working directory from the local stash if an Arcanist operation '.
'an Arcanist operation causes an unrecoverable error.', 'causes an unrecoverable error.',
'example' => 'false', 'arc'),
'default' => false, 'default' => false,
'example' => 'false',
), ),
); );
} }
@ -228,8 +236,9 @@ final class ArcanistSettings {
$value = true; $value = true;
} else { } else {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Type of setting '{$key}' must be boolean, like 'true' or ". pht(
"'false'."); "Type of setting '%s' must be boolean, like 'true' or 'false'.",
$key));
} }
break; break;
case 'list': case 'list':
@ -245,15 +254,19 @@ final class ArcanistSettings {
} }
} }
$list_example = '["apple", "banana", "cherry"]';
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Type of setting '{$key}' must be list. You can specify a list ". pht(
"in JSON, like: {$list_example}"); "Type of setting '%s' must be list. You can specify a list ".
"in JSON, like: %s",
$key,
'["apple", "banana", "cherry"]'));
case 'string': case 'string':
if (!is_scalar($value)) { if (!is_scalar($value)) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Type of setting '{$key}' must be string."); pht(
"Type of setting '%s' must be string.",
$key));
} }
$value = (string)$value; $value = (string)$value;
break; break;
@ -270,19 +283,25 @@ final class ArcanistSettings {
case 'string': case 'string':
if (!is_string($value)) { if (!is_string($value)) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Type of setting '{$key}' must be string."); pht(
"Type of setting '%s' must be string.",
$key));
} }
break; break;
case 'bool': case 'bool':
if ($value !== true && $value !== false) { if ($value !== true && $value !== false) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Type of setting '{$key}' must be boolean."); pht(
"Type of setting '%s' must be boolean.",
$key));
} }
break; break;
case 'list': case 'list':
if (!is_array($value)) { if (!is_array($value)) {
throw new ArcanistUsageException( throw new ArcanistUsageException(
"Type of setting '{$key}' must be list."); pht(
"Type of setting '%s' must be list.",
$key));
} }
break; break;
case 'wild': case 'wild':