add support for generic additional properties
[shpub.git] / src / shpub / Command / Note.php
index aceffcfb1e6ffc34cc46c6a74879d8f96db3230d..6fb7ceca34d0def575b79756ee9a7e3e1f369d4d 100644 (file)
@@ -48,6 +48,17 @@ class Command_Note
                 'default'     => null,
             )
         );
+        $cmd->addOption(
+            'x',
+            array(
+                'short_name'  => '-x',
+                'long_name'   => '--xprop',
+                'description' => 'Additional property',
+                'help_name'   => 'key=value',
+                'action'      => 'StoreArray',
+                'default'     => [],
+            )
+        );
         $cmd->addArgument(
             'text',
             [
@@ -132,6 +143,13 @@ class Command_Note
             }
         }
 
+        if (count($command->options['x'])) {
+            foreach ($command->options['x'] as $xproperty) {
+                list($propkey, $propval) = explode('=', $xproperty, 2);
+                $req->req->addPostParameter($propkey, $propval);
+            }
+        }
+
         $res = $req->send();
         $postUrl = $res->getHeader('Location');
         echo "Post created at server\n";