Goto navigation

shpub - micropub client for your shell

Command line micropub client written in PHP.

Download

shpub is released as self-contained .phar file that includes all dependencies.

Download the latest release:

  • 0.3.0, 2016-09-23
    • shpub-0.3.0.phar, 522 kiB
      SHA256: 6638db9f0f9b3d5edeec62ceff28af7713120cc6e42d2b1a43388bc5b8899ac2

See shpub downloads page for all released versions.

Dependencies

When using the git version, you need to have the following dependencies installed on your system:

Initial setup

$ ./bin/shpub.php connect http://mywebsite

Different user:

$ ./bin/shpub.php connect http://mywebsite http://mywebsite/user

If you pass a third parameter, then it will be the name of the connection. You can select a specific server/connection with -s on all commands.

List configured servers/connections

$ ./bin/shpub.php server
rr
test
anoweco.bogo
local2

Also try server -v which lists server and user URLs.

Post creation

shpub has support for the following post types:

shpub sends data form-encoded by default. To send JSON requests, use the --json option.

Create a like

$ ./bin/shpub.php like http://example.org/
Like created at server
http://anoweco.bogo/comment/23.htm

Create a reply

$ ./bin/shpub.php reply http://example.org/ "Hey, cool!"
Reply created at server
http://anoweco.bogo/comment/42.htm

Create a note

A normal note:

$ ./bin/shpub.php note "oh this is cool!"
Note created at server
http://known.bogo/2016/oh-this-is-cool.htm

Note with an image:

$ ./bin/shpub.php note -f image.jpg "this is so cute"
Note created at server
http://known.bogo/2016/this-is-so-cute

You can use -f several times to upload multiple files.

URL image upload:

$ ./bin/shpub.php note -f http://example.org/1.jpg "img url!"
Note created at server
http://known.bogo/2016/img-url

Delete/Undelete

You may delete and restore posts on micropub servers:

$ ./bin/shpub.php delete http://known.bogo/2016/like

Restore a deleted post:

$ ./bin/shpub.php undelete http://known.bogo/2016/like

Updates

Existing posts can be modified if the server supports this:

$ ./bin/shpub update --add category=foo category=bar\
                     --replace slug=differentslug\
                     --delete category=oldcat\
                     http://known.bogo/2016/post

File uploads

Most post types allow file uploads. Simply use -f:

$ ./bin/shpub.php note -f path/to/image.jpg "image test"
Note created at server
http://known.bogo/2016/image-test

The media endpoint is used automatically if the micropub endpoint has one. To force shpub to directly upload the file and skip the media endpoint, use the --direct-upload option:

$ ./bin/shpub.php note --direct-upload -f path/to/image.jpg "direct upload"

Use the upload command to upload files to the media endpoint without creating a post:

$ ./bin/shpub.php upload /path/to/file.jpg /path/to/file2.jpg
Uploaded file /path/to/file.jpg
http://test.bogo/micropub-media-endpoint/1474362040.2941/file.jpg
Uploaded file /path/to/file2.jpg
http://test.bogo/micropub-media-endpoint/1474362040.3383/file2.jpg

Debugging

To debug shpub or your micropub endpoint, use the --debug option to see curl command equivalents to the shpub HTTP requests:

$ ./bin/shpub.php -s known -d note "a simple note"
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'
Post created at server
http://known.bogo/2016/a-simple-note

About shpub

shpub's homepage is http://cweiske.de/shpub.htm

Source code

shpub's source code is available from http://git.cweiske.de/shpub.git or the mirror on github.

License

shpub is licensed under the AGPL v3 or later.

Author

shpub was written by Christian Weiske.

Navigation
File: shpub.htm | last update: 2017-01-23 23:31:21 Valid XHTML Valid CSS