TL;DR
I built a little helper tool named Bearing which allows for scripting Bear. It adds to Bear’s own capabilites by slightly abstracting and enhancing the experience:
- There’s a dedicated
bearing
CLI tool that accepts plain arguments. No morebear://…
calls, no more URL-encoding anything. - The CLI tool returns callback responses as JSON.
https://github.com/carlo/bearing
Why?
A few weeks back I switched from Evernote to Bear. I like Bear a lot (Markdown!) but its lack of Applescript support is irritating. Out of the box, Bear can be automated using its x-callback-url API, yes. But you don’t get any return values for those calls in a simple way.
I guess that’s why all existing Bear-related scripts go H.A.M. on its SQLite DB. The Bear FAQs say the following about that:
For most users in most situations, we highly recommend not [to work with Bear’s database]
Great. Also: understandable. That led to me setting out to build a simple wrapper app so I could work with Bear from command line and scripts in a easy and structured way without putting the notes database at risk.
What can it do?
Example: Creating a note
/usr/local/bin/bearing \
create \
--title="Bearing test note" \
--text="Works for me!"
… returns …
{
"title": "Bearing test note",
"identifier": "4963F8B4-3FE0-4835-B96D-7DCCB6101A62-1917-00013DC4BC4EE819",
"_success": true
}
Searching, tagging, editing etc are supported, as is everything else the x-callback-url API allows for. :)
Dope, let’s go
More information on usage, installation and whathaveyou can be found on Github:
https://github.com/carlo/bearing
It’s still early days, and it definitely still has a few rough edges, there are bugs. If you find any, just let me know, please!