DEV Community

Heiker
Heiker

Posted on

Anyone out there wants to make a key-value pair database for shell functions?

I don't know if you know this but deno added support for localStorage (details here) and now I want that for regular shell functions/scripts.

Something with this API would be nice.

  USAGE
    store [DOCUMENT] [COMMAND] [ARGS]

  COMMANDS
    create:
      creates an empty document/database

    query:
      extract the value of an entry.

    list:
      show all the entries of a document.

    add:
      creates a new entry in the document.

    update:
      change the value of an entry.

    remove:
      deletes an entry from the document.

  EXAMPLES

    All this examples use a document called `bookmark`.

    create a document:
        store bookmark create

    add an entry to a document:
        store bookmark add ddg "https://duckduckgo.com/"

    extract the value of an entry:
        store bookmark query ddg

    list all entries in a document:
        store bookmark list

    change the value of an entry:
        store bookmark update ddg "https://lite.duckduckgo.com/lite/"

    delete an entry from a document:
        store bookmark remove ddg
Enter fullscreen mode Exit fullscreen mode

Here is my attempt: store-json.

You get bonus points if you make this in a fancy compiled language that produces binaries for every platform out there.

Top comments (1)

Collapse
 
vonheikemen profile image
Heiker

Okay, listen, y'all. I did it. Did the fancy compiled language version: store.v. Got some precompiled binaries in the release page for linux and windows (my apologies to macos people, I couldn't cross compile to mac. Maybe later when I find out how to use github actions).

It's written in v. Like 300 lines of code, no external dependencies, using only built-in modules. The language is awesome you should check it out.