X-Git-Url: https://git.cweiske.de/shpub.git/blobdiff_plain/f46e4d3108d944bcf86f5905780f1fcfd441c036..6c791f2d0c159d56c570802c8d9bd3612262aa9e:/src/shpub/Command/Article.php diff --git a/src/shpub/Command/Article.php b/src/shpub/Command/Article.php index 9f40daf..018b403 100644 --- a/src/shpub/Command/Article.php +++ b/src/shpub/Command/Article.php @@ -6,16 +6,8 @@ class Command_Article extends Command_AbstractProps public static function opts(\Console_CommandLine $optParser) { $cmd = $optParser->addCommand('article'); - $cmd->addOption( - 'html', - array( - 'short_name' => '-h', - 'long_name' => '--html', - 'description' => 'Text content is HTML', - 'action' => 'StoreTrue', - 'default' => false, - ) - ); + $cmd->description = 'Create an article'; + static::addOptHtml($cmd); static::optsGeneric($cmd); $cmd->addArgument( 'title', @@ -38,15 +30,9 @@ class Command_Article extends Command_AbstractProps public function run(\Console_CommandLine_Result $cmdRes) { $req = new Request($this->cfg->host, $this->cfg); - $req->req->addPostParameter('h', 'entry'); - $req->req->addPostParameter('name', $cmdRes->args['title']); - if ($cmdRes->options['html']) { - $req->req->addPostParameter( - 'content[html]', $cmdRes->args['text'] - ); - } else { - $req->req->addPostParameter('content', $cmdRes->args['text']); - } + $req->setType('entry'); + $req->addProperty('name', $cmdRes->args['title']); + $req->addContent($cmdRes->args['text'], $cmdRes->options['html']); $this->handleGenericOptions($cmdRes, $req); $res = $req->send();