4 class Command_Repost extends Command_AbstractProps
6 public static function opts(\Console_CommandLine $optParser)
8 $cmd = $optParser->addCommand('repost');
9 static::optsGeneric($cmd);
14 'description' => 'URL that shall be reposted',
19 public function run(\Console_CommandLine_Result $cmdRes)
21 $url = Validator::url($cmdRes->args['url'], 'url');
26 $req = new Request($this->cfg->host, $this->cfg);
27 $req->req->addPostParameter('h', 'entry');
28 $req->req->addPostParameter('repost-of', $url);
30 $this->handleGenericOptions($cmdRes, $req);
33 $postUrl = $res->getHeader('Location');
34 if ($postUrl === null) {
35 Log::err('Error: Server sent no "Location" header and said:');
36 Log::err($res->getBody());
39 Log::info('Repost created at server');