Changeset View
Changeset View
Standalone View
Standalone View
src/workflow/ArcanistInstallCertificateWorkflow.php
Show All 13 Lines | return phutil_console_format(<<<EOTEXT | ||||
**install-certificate** [uri] | **install-certificate** [uri] | ||||
EOTEXT | EOTEXT | ||||
); | ); | ||||
} | } | ||||
public function getCommandHelp() { | public function getCommandHelp() { | ||||
return phutil_console_format(<<<EOTEXT | return phutil_console_format(<<<EOTEXT | ||||
Supports: http, https | Supports: http, https | ||||
Installs Conduit credentials into your ~/.arcrc for the given install | Installs Conduit credentials into your ~/.arcrc for the given server. | ||||
of Phabricator. You need to do this before you can use 'arc', as it | You need to do this before you can use 'arc', as it enables 'arc' to | ||||
enables 'arc' to link your command-line activity with your account on | link your command-line activity with your account on the web. Run | ||||
the web. Run this command from within a project directory to install | this command from within a project directory to install that | ||||
that project's certificate, or specify an explicit URI (like | project's certificate, or specify an explicit URI (like | ||||
"https://phabricator.example.com/"). | "https://devtools.example.com/"). | ||||
EOTEXT | EOTEXT | ||||
); | ); | ||||
} | } | ||||
public function getArguments() { | public function getArguments() { | ||||
return array( | return array( | ||||
'*' => 'uri', | '*' => 'uri', | ||||
); | ); | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | try { | ||||
if (in_array('token', $auth)) { | if (in_array('token', $auth)) { | ||||
$token_uri->setPath('/conduit/login/'); | $token_uri->setPath('/conduit/login/'); | ||||
$is_token_auth = true; | $is_token_auth = true; | ||||
} | } | ||||
} catch (Exception $ex) { | } catch (Exception $ex) { | ||||
// Ignore. | // Ignore. | ||||
} | } | ||||
echo phutil_console_format("**%s**\n", pht('LOGIN TO PHABRICATOR')); | echo phutil_console_format("**%s**\n", pht('LOG IN')); | ||||
echo phutil_console_format( | echo phutil_console_format( | ||||
"%s\n\n%s\n\n%s", | "%s\n\n%s\n\n%s", | ||||
pht( | pht( | ||||
'Open this page in your browser and login to '. | 'Open this page in your browser and log in if necessary:'), | ||||
'Phabricator if necessary:'), | |||||
$token_uri, | $token_uri, | ||||
pht('Then paste the API Token on that page below.')); | pht('Then paste the API Token on that page below.')); | ||||
do { | do { | ||||
$token = phutil_console_prompt(pht('Paste API Token from that page:')); | $token = phutil_console_prompt(pht('Paste API Token from that page:')); | ||||
$token = trim($token); | $token = trim($token); | ||||
if (strlen($token)) { | if (strlen($token)) { | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | if (count($uri) > 1) { | ||||
pht( | pht( | ||||
'Specify an explicit URI or run this command from within a '. | 'Specify an explicit URI or run this command from within a '. | ||||
'project which is configured with a %s.', | 'project which is configured with a %s.', | ||||
'.arcconfig')); | '.arcconfig')); | ||||
} | } | ||||
$uri = $conduit_uri; | $uri = $conduit_uri; | ||||
} | } | ||||
$example = 'https://phabricator.example.com/'; | $example = 'https://devtools.example.com/'; | ||||
$uri_object = new PhutilURI($uri); | $uri_object = new PhutilURI($uri); | ||||
$protocol = $uri_object->getProtocol(); | $protocol = $uri_object->getProtocol(); | ||||
if (!$protocol || !$uri_object->getDomain()) { | if (!$protocol || !$uri_object->getDomain()) { | ||||
throw new ArcanistUsageException( | throw new ArcanistUsageException( | ||||
pht( | pht( | ||||
'Server URI "%s" must include a protocol and domain. It should be '. | 'Server URI "%s" must include a protocol and domain. It should be '. | ||||
'in the form "%s".', | 'in the form "%s".', | ||||
Show All 24 Lines |