New Swift Package: tui-fuzzy-finder

Speaking of new Swift libraries, I released another one: tui-fuzzy-finder is a terminal UI library for Swift that provides an incremental search and selection UI that imitates the core functionality of fzf very closely.

I have a ton of scripts that wrap fzf. Some of them try to provide some kind of command line interface with options. Most of them work with pipes where I fetch data from somewhere, parse it with jq, feed it fzf, use the selection again as a part of a parameter for something else, etc. It's all great, except that I really don't love shell scripting.

With tui-fuzzy-finder I want to be able to write tools like that in a language I do actually enjoy a great deal. The package provides both a command line tool and a library, but the purpose of the command line tool is just to allow me to test the library, as writing automatic tests for terminal control is difficult. Competing with fzf in the general purpose CLI tool space is a non-goal.

I haven't implemented the preview features of fzf, nor key binding configuration. I'm not ruling either of those out, but I have not needed them yet and don't plan to work on them before a need arises.

Documentation at Swift Package Index.

New Swift Package: provision-info

I released a new Swift library! provision-info is a Swift package for macOS. Its purpose is to parse and show information about provisioning profile files. There's a command line tool and Swift library. The library part might work on iOS, too, but I have not tried. It relies on Apple's Security framework so no Linux.

It's not actually that new, but it's been sitting in a GitHub repo without any releases or changes for nearly three years. I needed the library in a tool at work a couple of weeks ago, so I added couple of features and finally made the first releases.

The CLI tool allows you to print out the basic metadata fields, the entitlements, the device IDs and the certificates in a profile file. You get them in plain text or as JSON. The library exposes the same data as Swift types.

There's documentation for the Swift APIs at Swift Package Index's excellent documentation hosting service. The command line tool prints out help with --help.

DotEnvy

I released a new Swift library, DotEnvy. It's a parser and loader for dotenv files.

Dotenv is a vaguely specified format that is supported by libraries found for most languages used in server-side development. The idea is that a twelve-factor app is supposed to read its configuration from environment variables, which can be a hassle to maintain during development. So you store them in a non-version controlled file called .env your application reads upon startup.

The format looks more or less like this:

KEY1=VALUE1
KEY2="VALUE2"
KEY3="MULTILINE
VALUE"
KEY4='REFERENCE TO ${KEY3}'

The Swift libraries I could find seemed to lack features and had not seen updates in years. I don't think a library like this needs a huge number of features, but multiline strings and variable references were something I wanted. And writing parsers is fun.

DotEnvy has good test coverage and online documentation. There's also pretty good error reporting.

There's also a command line tool that allows you to syntax check a dotenv file or convert it to JSON. I was going add a launcher (i.e. run dotenv-tool launch sh and it'd export the environment from .env and run sh), but discovered that pseudo terminals are a pain and my Stevens has gone missing. Patches are welcome.

I accidentally used the same name as a Rust dotenv library, but I decided there's enough namespacing provided by the language support that the risk of confusion isn't too great.

© Juri Pakaste 2024