4 class Command_Like extends Command_AbstractProps
6 public static function opts(\Console_CommandLine $optParser)
8 $cmd = $optParser->addCommand('like');
9 $cmd->description = 'Create a like';
10 static::optsGeneric($cmd);
15 'description' => 'URL that is liked',
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('like-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('Like created at server');