Sakfe

Sakfe (Stephen’s Abstract Key-File Engine) is a command-line file-based key-value store, written in pure Go 1.19 by Stephen Malone. It’s designed to take a directory of plain text files and present them as a key-value interface for command-line operations.

$ ls files/
alpha.txt
bravo.txt
charlie.txt

$ sakfe lst
alpha
bravo
charlie

$ sakfe get alpha
It's like a weird baby Redis full of text files!

Installation

To install Sakfe, you can use go install

go install github.com/wirehaiku/Sakfe/[email protected]

…or download a binary from the latest release.

Configuration

The only configuration Sakfe needs is two environment variables: the path to a directory, and the file extension you want to use.

# Sakfe's directory path. Variables and tildes welcome!
export SAKFE_DIR = "$HOME/my-text-files/"

# Sakfe's file extension. The leading dot is optional.
export SAKFE_EXT = ".txt"

Once you’ve set these two variables, you can start using Sakfe!

Commands

Sakfe has a deliberately simple command structure with minimal output. All arguments are strings unless explicitly stated otherwise, and arguments ending in ... can be given multiple times.

get KEYS...

Print the value of each key in KEYS, or print nothing if one doesn’t exist.

Example.

$ sakfe get alpha
This is file alpha!

$ sakfe get alpha bravo missing-key
This is file alpha!
This is file bravo!

set KEY VALS...

Set the value of KEY to VALS, each value separated by a newline.

Example.

$ sakfe set alpha "One."
$ sakfe get alpha
One.

$ sakfe set alpha "One." "Two." "Three."
$ sakfe get alpha
One.
Two.
Three.

del KEYS...

Delete each key in KEYS by deleting their underlying text files.

Example.

$ ls files/
alpha.txt
bravo.txt
charlie.txt

$ sakfe del alpha bravo

$ ls files/
charlie.txt

lst PREFIX

Print a list of all existing keys, or keys starting with PREFIX.

Example.

$ sakfe lst
alpha-one
alpha-two
bravo

$ sakfe lst alpha
alpha-one
alpha-two

Contributing

Please submit all bug reports and feature suggestions to the issue tracker. Thank you!

GitHub

View Github