X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/f3edeb601556e7741804b0c0bec2711996774bfe..6c791f2d0c159d56c570802c8d9bd3612262aa9e:/src/shpub/Command/Reply.php diff --git a/src/shpub/Command/Reply.php b/src/shpub/Command/Reply.php index b67d46b..61e4c59 100644 --- a/src/shpub/Command/Reply.php +++ b/src/shpub/Command/Reply.php @@ -3,19 +3,11 @@ namespace shpub; 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', @@ -28,7 +20,7 @@ class Command_Reply extends Command_AbstractProps 'text', [ 'optional' => false, - 'multiple' => true, + 'multiple' => false, 'description' => 'Reply text', ] ); @@ -42,9 +34,9 @@ class Command_Reply extends Command_AbstractProps } $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();