'paths', ); } protected function didParseArguments() { if (!$this->getArgument('paths')) { throw new ArcanistUsageException("Specify one or more files to upload."); } $this->paths = $this->getArgument('paths'); } public function requiresAuthentication() { return true; } private function getPaths() { return $this->paths; } public function run() { $conduit = $this->getConduit(); foreach ($this->paths as $path) { $name = basename($path); echo "Uploading '{$name}'...\n"; try { $data = Filesystem::readFile($path); } catch (FilesystemException $ex) { echo "Unable to upload file: ".$ex->getMessage()."\n"; continue; } $phid = $conduit->callMethodSynchronous( 'file.upload', array( 'data_base64' => base64_encode($data), 'name' => $name, )); $info = $conduit->callMethodSynchronous( 'file.info', array( 'phid' => $phid, )); echo " {$name}: ".$info['uri']."\n\n"; } echo "Done.\n"; return 0; } }