4 class Command_Repost extends Command_AbstractProps
6 public static function opts(\Console_CommandLine $optParser)
8 $cmd = $optParser->addCommand('repost');
9 $cmd->description = 'Create a repost';
10 static::optsGeneric($cmd);
15 'description' => 'URL that shall be reposted',
20 public function run(\Console_CommandLine_Result $cmdRes)
22 $url = Validator::url($cmdRes->args['url'], 'url');
27 $req = new Request($this->cfg->host, $this->cfg);
28 $req->setType('entry');
29 $req->addProperty('repost-of', $url);
31 $this->handleGenericOptions($cmdRes, $req);
34 $postUrl = $res->getHeader('Location');
35 if ($postUrl === null) {
36 Log::err('Error: Server sent no "Location" header and said:');
37 Log::err($res->getBody());
40 Log::info('Repost created at server');