'files',
array(
'short_name' => '-f',
- 'long_name' => '--files',
+ 'long_name' => '--file',
'description' => 'Files or URLs to upload',
'help_name' => 'PATH',
'action' => 'StoreArray',
'default' => null,
)
);
+ $cmd->addOption(
+ 'updated',
+ array(
+ 'long_name' => '--updated',
+ 'description' => 'Update date',
+ 'help_name' => 'DATE',
+ 'action' => 'StoreString',
+ 'default' => null,
+ )
+ );
$cmd->addOption(
'slug',
array(
'default' => [],
)
);
+ static::addOptJson($cmd);
+ }
+
+ protected static function addOptJson(\Console_CommandLine_Command $cmd)
+ {
+ $cmd->addOption(
+ 'json',
+ array(
+ 'long_name' => '--json',
+ 'description' => 'Send request data as JSON',
+ 'action' => 'StoreTrue',
+ 'default' => false,
+ )
+ );
}
protected function handleGenericOptions(
\Console_CommandLine_Result $cmdRes, Request $req
) {
+ $this->handleOptJson($cmdRes, $req);
+
if ($cmdRes->options['published'] !== null) {
$req->req->addPostParameter(
'published', $cmdRes->options['published']
);
}
+ if ($cmdRes->options['updated'] !== null) {
+ $req->req->addPostParameter(
+ 'updated', $cmdRes->options['updated']
+ );
+ }
if (count($cmdRes->options['categories'])) {
$req->addPostParameter(
'category', $cmdRes->options['categories']
$postParams = [];
foreach ($cmdRes->options['x'] as $xproperty) {
list($propkey, $propval) = explode('=', $xproperty, 2);
- if (!isset($postParams[$propkey] )) {
+ if (!isset($postParams[$propkey])) {
$postParams[$propkey] = [];
}
$postParams[$propkey][] = $propval;
}
}
+ protected function handleOptJson(
+ \Console_CommandLine_Result $cmdRes, Request $req
+ ) {
+ $req->setSendAsJson($cmdRes->options['json']);
+ }
+
protected function handleFiles(
\Console_CommandLine_Result $cmdRes, Request $req
) {