class Command_Reply extends Command_AbstractProps
{
- /**
- * @var Config
- */
- protected $cfg;
-
- public function __construct($cfg)
- {
- $this->cfg = $cfg;
- }
-
public static function opts(\Console_CommandLine $optParser)
{
$cmd = $optParser->addCommand('reply');
+ $cmd->description = 'Create a reply';
+ static::addOptHtml($cmd);
static::optsGeneric($cmd);
$cmd->addArgument(
'url',
'text',
[
'optional' => false,
- 'multiple' => true,
+ 'multiple' => false,
'description' => 'Reply text',
]
);
}
$req = new Request($this->cfg->host, $this->cfg);
- $req->req->addPostParameter('h', 'entry');
- $req->req->addPostParameter('content', implode(' ', $cmdRes->args['text']));
- $req->req->addPostParameter('in-reply-to', $url);
+ $req->setType('entry');
+ $req->addProperty('in-reply-to', $url);
+ $req->addContent($cmdRes->args['text'], $cmdRes->options['html']);
$this->handleGenericOptions($cmdRes, $req);
$res = $req->send();
$postUrl = $res->getHeader('Location');
- echo "Reply created at server\n";
- echo $postUrl . "\n";
+ Log::info('Reply created at server');
+ Log::msg($postUrl);
}
}
?>