What is Snipline CLI and Snipline?

Snipline CLI is an open source command-line application for developers to manage their shell command knowledge base.

Snipline is a desktop application which does the same but with a friendly GUI. It supports MacOS, Windows, Linux and the web. Snipline CLI can optionally sync with the Snipline desktop app.

The New Snipline CLI Release

Snipline CLI 0.3.0 has been a long time coming. The initial commit for 0.3.0 goes back to November last year, but I've been experimenting with features for it since September.

So what's new? Lots!

This is by far the biggest and most drastic update yet. If you've been following on Twitter, you may have seen some previews of the new TUI which I'm quite happy with.

The New Search Interface

Previously, snipcli search took one argument, the search string, and you'd enter a number to choose from a list of filtered snippets. Now, however, with a dollop of NCurses there's a fully interactive TUI. This adds a bunch of benefits:

  • Fuzzy match on search terms in real time.
  • Vim-like keyboard shortcuts to navigate the interface (shift+j + shift+k for up and down).
  • Edit, delete, run, or copy snippets all from the same command.

Improved Syncing and Sqlite Local Storage

Shortly after work started on the terminal interface it became clear the system was growing out of its JSON file storage roots. When I first chose JSON files as the storage method, it was a fast and dirty solution that just worked. Unfortunately, getting editing/deleting snippets to work with JSON files was like walking up Mount Snowdon. Long and tiring.

Snipline CLI 0.3.0 has moved the snippet storage to Sqlite. There's a migration process in place, too. If you've used Snipline CLI previously, upgrading and running sync, new, or init will import snippets from JSON to a new Sqlite file.

With a better database in place, syncing snippets to the Snipline web-based service has improved. Syncing works for both downloading and uploading snippets, whereas in version 0.2.0 syncing only downloaded snippets.

Editing and Deleting Snippets

Editing works in a similar fashion to creating new snippets from version 0.2.0. Choose a snippet from search , press Shift+e and your preferred text-editor will open the snippet TOML file. Just save and quit to update the snippet.

Above you can see a a preview of the editing workflow. A snippet is chosen from the search command and pressing shift+e to edit. Vim pops open, the documentation field is altered, finally, save+quit is run to update the snippet.

What's next?

0.3.1 has already been released to squash a few bugs. Now it's back onto improving Snipline for Desktop. Keep your eyes pealed for a new release in the next month or so. It's also dangerously close to Snipline's first birthday so I'll be writing a year in review update hopefully in time for that.