1 **************************************
2 shpub - micropub client for your shell
3 **************************************
4 Command line `micropub <https://micropub.net/>`_ client written in PHP.
12 shpub is released as self-contained ``.phar`` file that includes
17 See `shpub downloads page <http://cweiske.de/shpub-download.htm>`_
18 for all released versions.
23 After downloading ``shpub-x.y.z.phar``, you can either use it directly::
25 $ php /path/to/shpub-x.y.z.phar --version
27 or make it more easily accessible::
29 $ mv /path/to/shpub-x.y.z.phar /usr/local/bin/shpub
30 $ chmod +x /usr/local/bin/shpub
33 You might need ``sudo`` to be able to copy it into the ``/usr/local/bin/``
36 If you're running from the git checkout, start it as follows::
38 $ ./bin/shpub.php --version
43 When using the git version, you need to have the following dependencies
44 installed on your system:
47 - PEAR's `Console_CommandLine <http://pear.php.net/package/Console_CommandLine>`_
48 - PEAR's `HTTP_Request2 <http://pear.php.net/package/HTTP_Request2>`_
49 - PEAR's `MIME_Type <http://pear.php.net/package/MIME_Type>`_
50 - PEAR's `NET_URL2 <http://pear.php.net/package/Net_URL2>`_
58 $ shpub connect http://mywebsite
60 In case there are multiple users on the same server::
62 $ shpub connect http://sharedwebsite http://shareswebsite/user
64 If you pass a third parameter, then that will be the name of the connection.
65 You can select a specific server/connection with ``-s`` on all commands.
68 List configured servers/connections
69 ===================================
78 Also try ``server -v`` which lists server and user URLs.
84 shpub has support for the following post types:
86 - `article <http://indieweb.org/article>`_
87 - `bookmark <http://indieweb.org/bookmark>`_
88 - `like <http://indieweb.org/like>`_
89 - `note <http://indieweb.org/note>`_
90 - `reply <http://indieweb.org/reply>`_
91 - `repost <http://indieweb.org/repost>`_
92 - `rsvp <http://indieweb.org/rsvp>`_
94 By default ``shpub`` sends data form-encoded.
95 To send JSON requests, use the ``--json`` option.
102 $ shpub like http://example.org/
103 Like created at server
104 http://anoweco.bogo/comment/23.htm
110 $ shpub reply http://example.org/ "Hey, cool!"
111 Reply created at server
112 http://anoweco.bogo/comment/42.htm
119 $ shpub note "oh this is cool!"
120 Note created at server
121 http://known.bogo/2016/oh-this-is-cool.htm
125 $ shpub note -f image.jpg "this is so cute"
126 Note created at server
127 http://known.bogo/2016/this-is-so-cute
129 You can use ``-f`` several times to upload multiple files.
133 $ shpub note -f http://example.org/1.jpg "img url!"
134 Note created at server
135 http://known.bogo/2016/img-url
137 Load note content from a file::
139 $ shpub note - < /path/to/file.txt
140 Note created at server
141 http://known.bogo/2017/some-note
146 You may create custom post types with the ``x`` command.
147 This is useful if your micropub endpoint supports additional types,
148 like `known <http://withknown.com/>`__'s
149 `"annotation" type <https://cweiske.de/tagebuch/micropub-comments-known.htm>`__
150 (comments and likes for posts).
152 Create a comment to a known post::
154 $ shpub x annotation\
155 -x url=http://known.bogo/2016/example-domain-1\
158 -x userurl=http://example.org/~barryf\
159 -x userphoto=http://example.org/~barryf/avatar.jpg\
160 -x content="There is a typo in paragraph 1. 'Fou' should be 'Foo'"
166 You may delete and restore posts on micropub servers::
168 $ shpub delete http://known.bogo/2016/like
170 Restore a deleted post::
172 $ shpub undelete http://known.bogo/2016/like
178 Existing posts can be modified if the `server supports this`__::
180 $ ./bin/shpub update --add category=foo category=bar\
181 --replace slug=differentslug\
182 --delete category=oldcat\
183 http://known.bogo/2016/post
185 __ https://indieweb.org/Micropub/Servers#Implementation_status
191 You may list the syndication targets defined on the server::
195 https://news.indieweb.org/en
197 Then specify it when creating a post::
199 $ shpub article -x mp-syndicate-to=https://news.indieweb.org/en title text
204 Most post types allow file uploads. Simply use ``-f``::
206 $ shpub note -f path/to/image.jpg "image test"
207 Note created at server
208 http://known.bogo/2016/image-test
210 The media endpoint is used automatically if the micropub endpoint has one.
211 To force ``shpub`` to directly upload the file and skip the media endpoint,
212 use the ``--direct-upload`` option::
214 $ shpub note --direct-upload -f path/to/image.jpg "direct upload"
216 Use the ``upload`` command to upload files to the media endpoint without
219 $ shpub upload /path/to/file.jpg /path/to/file2.jpg
220 Uploaded file /path/to/file.jpg
221 http://test.bogo/micropub-media-endpoint/1474362040.2941/file.jpg
222 Uploaded file /path/to/file2.jpg
223 http://test.bogo/micropub-media-endpoint/1474362040.3383/file2.jpg
229 To debug ``shpub`` or your micropub endpoint, use the ``--debug`` option
230 to see ``curl`` command equivalents to the shpub HTTP requests::
232 $ shpub -s known -d note "a simple note"
233 curl -X POST -H 'User-Agent: shpub' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer abc' -d 'h=entry' -d 'content=a simple note' 'http://known.bogo/micropub/endpoint'
234 Post created at server
235 http://known.bogo/2016/a-simple-note
238 See curl commands only
239 ======================
240 You may use the ``--dry-run`` option to make shpub not send any modifying
241 HTTP requests (e.g. POST and PUT).
243 Together with ``--debug`` you can use this to get curl commands without sending
244 anything to the server::
246 $ shpub --debug --dry-run like example.org
247 curl -X POST -H 'User-Agent: shpub' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer cafe' -d 'h=entry' -d 'like-of=http://example.org' 'http://anoweco.bogo/micropub.php'
248 Like created at server
249 http://example.org/fake-response
256 Releasing a new version
257 =======================
259 #. Add notes to ``ChangeLog``
260 #. Update version number in ``build.xml`` and ``src/shpub/Cli.php``
262 #. Commit and tag the version
263 #. In the ``cweiske.de`` directory, run ``./scripts/update-shpub.sh``
269 shpub's homepage is http://cweiske.de/shpub.htm
274 shpub's source code is available from http://git.cweiske.de/shpub.git
275 or the `mirror on github`__.
277 __ https://github.com/cweiske/shpub
282 shpub is licensed under the `AGPL v3 or later`__.
284 __ http://www.gnu.org/licenses/agpl.html
289 shpub was written by `Christian Weiske`__.
291 __ http://cweiske.de/