4 class Command_Article extends Command_AbstractProps
11 public function __construct($cfg)
16 public static function opts(\Console_CommandLine $optParser)
18 $cmd = $optParser->addCommand('article');
23 'long_name' => '--html',
24 'description' => 'Text content is HTML',
25 'action' => 'StoreTrue',
29 static::optsGeneric($cmd);
35 'description' => 'Title/Name',
43 'description' => 'Text content',
48 public function run(\Console_CommandLine_Result $cmdRes)
50 $req = new Request($this->cfg->host, $this->cfg);
51 $req->req->addPostParameter('h', 'entry');
52 $req->req->addPostParameter('name', $cmdRes->args['title']);
53 if ($cmdRes->options['html']) {
54 $req->req->addPostParameter(
55 'content[html]', $cmdRes->args['text']
58 $req->req->addPostParameter('content', $cmdRes->args['text']);
60 $this->handleGenericOptions($cmdRes, $req);
63 $postUrl = $res->getHeader('Location');
64 Log::info('Article created at server');