#key-value #command-line-tool #dotenv #environment #env #config

bin+lib kvu

The simplest command line tool to manage key-value pair lines

4 releases

0.1.3 Jul 8, 2022
0.1.2 Jul 7, 2022
0.1.1 Jul 4, 2022
0.1.0 Jul 4, 2022

#1545 in Text processing

MIT license

11KB
114 lines

kvu

Workflows - CI crates.io version crates.io license crates.io downloads docs.rs

The simplest command line tool to manage key-value pair lines.

┌──────────────────────────┐                                         ┌──────────────────────────┐
│ DB_URI=postgres://db/kvu │         ┌─────────────────────┐         │ DB_URI=postgres://db/kvu │DB_USERNAME=username     │──stdin─▶│ kvu DB_USERNAME=kvu │─stdout─▶│ DB_USERNAME=kvu          │
│ DB_PASSWORD=password     │         └─────────────────────┘         │ DB_PASSWORD=password     │
└──────────────────────────┘                                         └──────────────────────────┘

Installation

From binaries

The release page includes precompiled binaries for Linux, macOS and Windows.

From Cargo

With Rust's package manager cargo, you can install kvu via:

cargo install kvu

Note that rust version 1.62.0 or later is required.

Usage

Arguments without any flag works as upsert operation - create new pair if the key does not exist, or update the value of the key if the key does exist.

$ echo -e "BUCKET=public\nREGION=ap-southeast-1" | kvu TOKEN=348a1912 REGION=eu-north-1
BUCKET=public
REGION=eu-north-1
TOKEN=348a1912

-c/--create Create new pair

Does nothing when the key exists.

$ echo -e "BUCKET=public\nREGION=ap-southeast-1" | kvu --create REGION=eu-north-1
BUCKET=public
REGION=ap-southeast-1

-u/--update Update existing pair

Does nothing when the key does not exist.

$ echo -e "BUCKET=public\nREGION=ap-southeast-1" | kvu --update TOKEN=348a1912 
BUCKET=public
REGION=ap-southeast-1

-d/--delete Delete existing pair

Does nothing when the key does not exist.

$ echo -e "BUCKET=public\nREGION=ap-southeast-1" | kvu --delete REGION
BUCKET=public

Dependencies

~1.5MB
~21K SLoC