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

Specify custom arcrc filename

Summary: allow specifing an replacement .arcrc file, for the odd cases.

Test Plan: `echo {} | arc call-conduit user.whoami` with and without `--arcrc-file=`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: Korvin, aran

Differential Revision: https://secure.phabricator.com/D7208
This commit is contained in:
Aviv Eyal 2013-10-25 15:57:38 -07:00 committed by epriestley
parent 0d212ccf5a
commit 6dc04af6e8
3 changed files with 27 additions and 1 deletions

View file

@ -21,6 +21,10 @@ $args->parsePartial(
array(
'name' => 'skip-arcconfig',
),
array(
'name' => 'arcrc-file',
'param' => 'filename',
),
array(
'name' => 'conduit-uri',
'param' => 'uri',
@ -44,6 +48,7 @@ $force_conduit = $args->getArg('conduit-uri');
$force_conduit_version = $args->getArg('conduit-version');
$conduit_timeout = $args->getArg('conduit-timeout');
$skip_arcconfig = $args->getArg('skip-arcconfig');
$custom_arcrc = $args->getArg('arcrc-file');
$load = $args->getArg('load-phutil-library');
$help = $args->getArg('help');
@ -136,6 +141,9 @@ try {
$working_copy);
}
if ($custom_arcrc) {
$configuration_manager->setUserConfigurationFileLocation($custom_arcrc);
}
$user_config = $configuration_manager->readUserConfigurationFile();
$config_class = $working_copy->getProjectConfig('arcanist_configuration');

View file

@ -9,6 +9,7 @@ final class ArcanistConfigurationManager {
private $runtimeConfig = array();
private $workingCopy = null;
private $customArcrcFilename = null;
public function setWorkingCopyIdentity(
ArcanistWorkingCopyIdentity $working_copy) {
@ -147,7 +148,6 @@ final class ArcanistConfigurationManager {
return false;
}
/**
* This is probably not the method you're looking for; try
* @{method:readUserArcConfig}.
@ -204,7 +204,20 @@ final class ArcanistConfigurationManager {
}
}
public function setUserConfigurationFileLocation($custom_arcrc) {
if (!Filesystem::pathExists($custom_arcrc)) {
throw new Exception(
"Custom arcrc file was specified, but it was not found!");
}
$this->customArcrcFilename = $custom_arcrc;
}
public function getUserConfigurationFileLocation() {
if (strlen($this->customArcrcFilename)) {
return $this->customArcrcFilename;
}
if (phutil_is_windows()) {
return getenv('APPDATA').'/.arcrc';
} else {

View file

@ -199,6 +199,11 @@ EOTEXT
__--conduit-timeout__ __timeout__
Override the default Conduit timeout. Specified in seconds.
__--skip-arcconfig__
Skip the working copy configuration file
__--arcrc-file__ __filename__
Use provided file instead of ~/.arcrc.
EOTEXT
);
}