kv 4 u - A key value pair command line utility
- Posted: Oct 31, 2012 at 6:00 AM
- 5,250 Views
Today's project is deceptively simple one, yet one that fires up the way back machine for me.
Once upon a time, about 1.97 million years ago, I manned a tech support desk, answering tech calls from customers about the products they had purchased from our company. This was in the 90's and Windows 3.0/3.1 was the hot thing, yet we still mostly lived in a DOS prompt. And being a call jockey time on call was a key metric. So we'd do everything we could to streamline our information retrieval, leveraging command line utilities, TSR's, writing batch files to help speed access to info, etc.
Anyway, today's project would have come in real handy then, and looks like, given the resurgence of the command line, handy today too. BTW, shout-out to the secretGeek and his/her blog post, kv can remember it for you, wholesale, that brought it to my attention.
kv -- a command-line key-value store integrated with the clipboard.
inspired by: https://github.com/stevenleeg/boo
kv name fred smith
saves the the value, 'fred smith' under the key, 'name'
retrieve the value 'fred smith' straight to your clipboard.
lists all keys
lists all keys that match the pattern 'h*'
kv -r name
will remove the key ‘name’ (and its value) from your store
You can also pipe a value in, e.g.
echo Hello Fred | kv Greeting
will store 'Hello Fred' under the key 'Greeting'
type File.xml | kv myFile
will store the content of 'File.xml' under the key 'myFile'
Keys are case-insensitive.
Where does it store the data?
Each key and value is stored in a separate file, in the folder %localappdata%\kv\kv.snippet\
Each file in that folder is named after its key (encoded so that special characters are supported)
And as you would expect, given I'm writing about it here, the source, C#, for this utility is available too.
Grabbing the latest check-in, it compiled and ran with no problems;
As you can see, it's looks simple, but so many things do in hindsight. There's a number of cool tips and tricks in this utility, from handling data piped into it, to the stashing of the data (via http://stashy.codeplex.com) and more. This utility stands on the shoulders of others (as do most of our app's), giving credit where credit is due, yet combing them into something new.