mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 00:42:40 +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:
parent
0d212ccf5a
commit
6dc04af6e8
3 changed files with 27 additions and 1 deletions
|
@ -21,6 +21,10 @@ $args->parsePartial(
|
||||||
array(
|
array(
|
||||||
'name' => 'skip-arcconfig',
|
'name' => 'skip-arcconfig',
|
||||||
),
|
),
|
||||||
|
array(
|
||||||
|
'name' => 'arcrc-file',
|
||||||
|
'param' => 'filename',
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'name' => 'conduit-uri',
|
'name' => 'conduit-uri',
|
||||||
'param' => 'uri',
|
'param' => 'uri',
|
||||||
|
@ -44,6 +48,7 @@ $force_conduit = $args->getArg('conduit-uri');
|
||||||
$force_conduit_version = $args->getArg('conduit-version');
|
$force_conduit_version = $args->getArg('conduit-version');
|
||||||
$conduit_timeout = $args->getArg('conduit-timeout');
|
$conduit_timeout = $args->getArg('conduit-timeout');
|
||||||
$skip_arcconfig = $args->getArg('skip-arcconfig');
|
$skip_arcconfig = $args->getArg('skip-arcconfig');
|
||||||
|
$custom_arcrc = $args->getArg('arcrc-file');
|
||||||
$load = $args->getArg('load-phutil-library');
|
$load = $args->getArg('load-phutil-library');
|
||||||
$help = $args->getArg('help');
|
$help = $args->getArg('help');
|
||||||
|
|
||||||
|
@ -136,6 +141,9 @@ try {
|
||||||
$working_copy);
|
$working_copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($custom_arcrc) {
|
||||||
|
$configuration_manager->setUserConfigurationFileLocation($custom_arcrc);
|
||||||
|
}
|
||||||
$user_config = $configuration_manager->readUserConfigurationFile();
|
$user_config = $configuration_manager->readUserConfigurationFile();
|
||||||
|
|
||||||
$config_class = $working_copy->getProjectConfig('arcanist_configuration');
|
$config_class = $working_copy->getProjectConfig('arcanist_configuration');
|
||||||
|
|
|
@ -9,6 +9,7 @@ final class ArcanistConfigurationManager {
|
||||||
|
|
||||||
private $runtimeConfig = array();
|
private $runtimeConfig = array();
|
||||||
private $workingCopy = null;
|
private $workingCopy = null;
|
||||||
|
private $customArcrcFilename = null;
|
||||||
|
|
||||||
public function setWorkingCopyIdentity(
|
public function setWorkingCopyIdentity(
|
||||||
ArcanistWorkingCopyIdentity $working_copy) {
|
ArcanistWorkingCopyIdentity $working_copy) {
|
||||||
|
@ -147,7 +148,6 @@ final class ArcanistConfigurationManager {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is probably not the method you're looking for; try
|
* This is probably not the method you're looking for; try
|
||||||
* @{method:readUserArcConfig}.
|
* @{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() {
|
public function getUserConfigurationFileLocation() {
|
||||||
|
if (strlen($this->customArcrcFilename)) {
|
||||||
|
return $this->customArcrcFilename;
|
||||||
|
}
|
||||||
|
|
||||||
if (phutil_is_windows()) {
|
if (phutil_is_windows()) {
|
||||||
return getenv('APPDATA').'/.arcrc';
|
return getenv('APPDATA').'/.arcrc';
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -199,6 +199,11 @@ EOTEXT
|
||||||
__--conduit-timeout__ __timeout__
|
__--conduit-timeout__ __timeout__
|
||||||
Override the default Conduit timeout. Specified in seconds.
|
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
|
EOTEXT
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue