4 class Command_Article extends Command_AbstractProps
6 public static function opts(\Console_CommandLine $optParser)
8 $cmd = $optParser->addCommand('article');
13 'long_name' => '--html',
14 'description' => 'Text content is HTML',
15 'action' => 'StoreTrue',
19 static::optsGeneric($cmd);
25 'description' => 'Title/Name',
33 'description' => 'Text content',
38 public function run(\Console_CommandLine_Result $cmdRes)
40 $req = new Request($this->cfg->host, $this->cfg);
41 $req->req->addPostParameter('h', 'entry');
42 $req->req->addPostParameter('name', $cmdRes->args['title']);
43 if ($cmdRes->options['html']) {
44 $req->req->addPostParameter(
45 'content[html]', $cmdRes->args['text']
48 $req->req->addPostParameter('content', $cmdRes->args['text']);
50 $this->handleGenericOptions($cmdRes, $req);
53 $postUrl = $res->getHeader('Location');
54 Log::info('Article created at server');