Bonus Drop #58 (2024-08-18): One-Thing Well

sfeed; gen-license; gitnr

We’ve got three projects that all do one thing, and do said thing well (truth-be-told, there are a handful of “one-thing well” CLIs in the first section).


TL;DR

(This is an AI-generated summary of today’s Drop using Sonnet via Perplexity.)

  • sfeed: A collection of command-line tools for parsing, updating, and formatting RSS and Atom feeds, designed to be simple, fast, and flexible. It includes various utilities for processing feed data into different formats and a curses interface for browsing. (https://codemadness.org/sfeed.html)
  • gen-license: A command-line tool for generating software licenses, allowing users to quickly create LICENSE files for their projects. An alternative to this is the ‘license’ tool from sourcehut, which provides similar functionality without making API calls to GitHub. (https://github.com/nexxeln/license-generator)
  • gitnr: A cross-platform CLI and TUI for generating .gitignore files using templates from various sources, including GitHub’s official repository, TopTal’s collection, local files, and remote URLs. It automatically filters out duplicate ignore lines for efficient .gitignore creation. (https://github.com/reemus-dev/gitnr/tree/main)

sfeed

sfeed (GH) is a collection of command-line tools for parsing, updating, and formatting RSS and Atom feeds. It’s designed to be simple, fast, and flexible, following the Unix philosophy of doing one thing well and allowing easy integration with other tools.

The main component of the sfeed cinematic universe (SCU) processes XML feeds into a tab-separated format, since XML is all kinds of horribad. This conversion makes it very straightforward to manipulate the data with any set of modern data tools. The SCU includes tools for updating feeds, filtering content, merging items, and converting feed data into formats like JSON!!, HTML, plain text, and more. There’s even a well-executed curses interface for RSS feed browsing. And, it makes extensive use of configuration files, letting us implement custom filters or override default behaviors, such as download methods (by default, sfeed relies on curl).

Speaking of the SCU, here’s what’s inside the git tin:

  • sfeed: Read XML RSS or Atom feed data from stdin. Write feed data in TAB-separated format to stdout.
  • sfeed_atom: Format feed data (TSV) to an Atom feed.
  • sfeed_content: View item content, for use with sfeed_curses.
  • sfeed_curses: Format feed data (TSV) to a curses interface.
  • sfeed_frames: Format feed data (TSV) to HTML file(s) with frames.
  • sfeed_gopher: Format feed data (TSV) to Gopher files.
  • sfeed_html: Format feed data (TSV) to HTML.
  • sfeed_json: Format feed data (TSV) to JSON Feed.
  • sfeed_opml_export: Generate an OPML XML file from a sfeedrc config file.
  • sfeed_opml_import: Generate a sfeedrc config file from an OPML XML file.
  • sfeed_markread: Mark items as read/unread, for use with sfeed_curses.
  • sfeed_mbox: Format feed data (TSV) to mbox.
  • sfeed_plain: Format feed data (TSV) to a plain-text list.
  • sfeed_twtxt: Format feed data (TSV) to a twtxt feed.
  • sfeed_update: Update feeds and merge items.
  • sfeed_web: Find URLs to RSS/Atom feed from a webpage.
  • sfeed_xmlenc: Detect character-set encoding from a XML stream.
  • sfeedrc.example: Example config file. Can be copied to $HOME/.sfeed/sfeedrc.
  • style.css: Example stylesheet to use with sfeed_html and sfeed_frames.

If you’re “just” going to use it as a feed reader, all you have to do is add feed URLs in a sfeedrc file, run sfeed_update to fetch and parse feeds, and choose a formatting tool to display the results.

But, it can do way more than just that!

For example, you can discover if a site has an feed:

$ curl -s 'https://rud.is/b/' | sfeed_web
https://rud.is/b/feed/  application/rss+xml
https://rud.is/b/comments/feed/ application/rss+xml

Use sfeed_json to work with feed elements in, say, jq:

$ curl -s "https://dailydrop.hrbrmstr.dev/feed/" | sfeed | sfeed_json | jq '.items[] | .title'
"Drop #518 (2024-08-16): Clean As A Whistle"
"Drop #517 (2024-08-15): Thursdataday"
"Drop #516 (2024-08-13): Typography Tuesday"
"Drop #515 (2024-08-12): Starting The Week In Style[s]"
"Bonus Drop #57 (2024-08-11): Vector Similarly Search And RAG-Lite"
"Drop #514 (2024-08-09): DuckDB Vector Search"
"Drop #513 (2024-08-08): TUI Thursday"
"Drop #512 (2024-08-07): The One With All The JSON Resources"
"Drop #511 (2024-08-06): Typography Tuesday"
"Bonus Drop #56 (2024-08-03): Knowledge Drop"

Use sfeed_content to do a quick, paginated read:

$ curl -s "https://dailydrop.hrbrmstr.dev/feed/" | sfeed | sfeed_content

You’ll need to do some work, since neither a brew info sfeed nor a apt search sfeed came up with any hits.

git clone git://git.codemadness.org/sfeed then make initially failed for me on macOS, but the quick fix was to put:

CFLAGS += -D_DARWIN_C_SOURCE

right before the

# use system flags.

line.

The README is extensive, and has plenty of usage examples to help get you started.


gen-license

Photo by Pixabay on Pexels.com

I switch between many editors in a given day for many reasons. Lately, I’ve been trying to use Zed as the main editor for Go projects. A sign that I had become far to reliant on VS Cod[e|ium] extensions was when I was looking to add a LICENSE file to a recent project, and brought up Zed’s command palette to use the license generator that did not exist (I have a VS Codium extension installed for this).

Yes I could keep a copy of the tiny handful of licenses I use and make a Zsh function to copy one to a current directory, but why do that when I can cargo install gen-license and have them all in a pick list with one command:

$ gen-license
✔ Choose a license · MIT License
✔ Enter your name · Bob Rudis
✔ Enter year · 2024
✔ License created successfully
  Please take a look at it and make changes if necessary

But, I should have read the code before using it as my setup notified me that an unknown app was making a call to GitHub’s API (I try hard to not give any telemetry to the one of the most evil corproations on the planet).

If that bugs you as much as it did me, then you, too, can clone https://sr.ht/~zethra/license/, follow the installation guidance and then run:

$ license list | fzf

to get a similar experience.


gitnr

After the revelation in the middle section, I set out to replace the editor plugin I use to maintain .gitignore files in project with a CLI utility.

Gitnr is a cross-platform CLI and TUI that generates .gitignore files using templates from various sources, including:

  • GitHub’s official gitignore repository
  • TopTal‘s gitignore collection
  • Local files on your system
  • Remote URLs

When using multiple templates, Gitnr automatically filters out duplicate ignore lines, ensuring a clean and efficient .gitignore file. For example:

$ gitnr create gh:Go tt:go

will filter out all the duplicates.

The TUI (in the section header) is also nicely done.


FIN

Remember, you can follow and interact with the full text of The Daily Drop’s free posts on Mastodon via @dailydrop.hrbrmstr.dev@dailydrop.hrbrmstr.dev ☮️

3 responses to “Bonus Drop #58 (2024-08-18): One-Thing Well”

  1. Drop #519 (2024-08-22): Cache Me If You Can – hrbrmstr's Daily Drop Avatar

    […] the content at any URL into super clean Markdown. You can see that right now by hitting up https://dailydrop.hrbrmstr.dev/2024/08/18/bonus-drop-58-2024-08-18-one-thing-well/ — which is a Jina AI link to the Markdown version of the last Bonus Drop. It also converts […]

    Like

  2. Eyayaw Beze Avatar
    Eyayaw Beze

    thanks for gen-license and gitnr. I have been using vs code extensions for creating license and .gitignore.

    https://github.com/ultram4rine/vscode-choosealicense
    https://github.com/CodeZombieCH/vscode-gitignore

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.