http://known.bogo/2016/img-url
+Custom post types
+=================
+You may create custom post types with the ``x`` command.
+This is useful if your micropub endpoint supports additional types,
+like known's ``annotation`` type (comments and likes for posts).
+
+Create a comment to a known post::
+
+ $ ./bin/shpub.php x annotation\
+ -x url=http://known.bogo/2016/example-domain-1\
+ -x type=reply\
+ -x username=barryf\
+ -x userurl=http://example.org/~barryf\
+ -x userphoto=http://example.org/~barryf/avatar.jpg\
+ -x content="There is a typo in paragraph 1. 'Fou' should be 'Foo'"
+
+
===============
Delete/Undelete
===============
Command_Repost::opts($optParser);
Command_Rsvp::opts($optParser);
Command_Bookmark::opts($optParser);
+ Command_X::opts($optParser);
Command_Delete::opts($optParser);
Command_Undelete::opts($optParser);
--- /dev/null
+<?php
+namespace shpub;
+
+/**
+ * Create a object with a custom type
+ *
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @link http://cweiske.de/shpub.htm
+ */
+class Command_X extends Command_AbstractProps
+{
+ public static function opts(\Console_CommandLine $optParser)
+ {
+ $cmd = $optParser->addCommand('x');
+ $cmd->description = 'Create a custom type';
+ static::addOptHtml($cmd);
+ static::optsGeneric($cmd);
+ $cmd->addArgument(
+ 'type',
+ [
+ 'optional' => false,
+ 'multiple' => false,
+ 'description' => 'Microformat object type',
+ ]
+ );
+ }
+
+ public function run(\Console_CommandLine_Result $cmdRes)
+ {
+ $req = new Request($this->cfg->host, $this->cfg);
+ $req->setType($cmdRes->args['type']);
+ $this->handleGenericOptions($cmdRes, $req);
+
+ $res = $req->send();
+ $postUrl = $res->getHeader('Location');
+ Log::info('Object created at server');
+ Log::msg($postUrl);
+ }
+}
+?>