Skip to content

Use Redis/Valkey/KeyDB/etc. from the fish shell

License

Notifications You must be signed in to change notification settings

dbohdan/redfish

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

redfish

redfish lets you use Redis, Valkey (an open-source fork of Redis), KeyDB, and other compatible databases from the fish shell.

redfish is a wrapper around redis-cli and compatible clients. It acts as a partial general-purpose Redis/Valkey/KeyDB/etc. client library. The use of a *-cli binary imposes limitations on what data redfish can store. Line feeds are not allowed in values. It can load and store simple values and also fish lists as database lists.

Contents

Requirements

  • fish 3.4 or later. Earlier versions will not work.
  • redis-cli(1), valkey-cli(1), keydb-cli(1), or another compatible client.
  • A Redis, Valkey, KeyDB, or another server compatible with the client (the default local server by default).

Usage

usage: redfish command [ARG ...]
       redfish del [-v|--verbose] KEY [KEY ...]
       redfish exists KEY
       redfish get [-r|--raw] KEY
       redfish get-list VAR KEY
       redfish incr KEY [INCREMENT]
       redfish keys PATTERN
       redfish set KEY VALUE
       redfish set-list KEY [VALUE ...]

See example.fish for an example of how you can use redfish.

Optionally, set the variable __redfish_client_command in your shell to use a different client than redis-cli or to pass arguments to the client.

Installation

Using Fisher

To install redfish with Fisher, run the command:

fisher install dbohdan/redfish

Manual

  1. Clone the repository or download and extract a source archive.
  2. Run install.fish.

Motivation

I wrote redfish as another way to have associative arrays or dictionaries in fish. Using redfish requires you to keep its limitations in mind. Shelling out to *-cli makes data access slow. A fun aspect of using a networked data store is that it essentially gives you universal variables, only available over the network and not just to fish. If you don't need this aspect, another dictionary implementation is probably better.

Problems with complex scripting in fish

When writing redfish and example.fish, I discovered that several aspects of the language design invited bugs and made development distinctly less fun for me. My experience has lead me to believe that you shouldn't write complex scripts in fish. Make no mistake: I still very much like fish as an interactive shell. I have written about my problems with the language.

License

MIT.

Releases

No releases published

Packages

No packages published

Languages