refactor: remove digest fields from db and item struct

This commit is contained in:
Andrew Phillips
2025-05-21 20:24:17 -03:00
committed by Andrew Phillips (aider)
parent 894a893536
commit a8c363333c
3 changed files with 31 additions and 53 deletions

View File

@@ -1,10 +1,8 @@
#+TITLE: Keep
#+AUTHOR: Andrew Phillips
#+EMAIL: andrew@gt0.ca
#+DATE: 2024-01-01
* Introduction
Keep is a command-line utility designed to manage temporary files created on the command line. Instead of redirecting output to a temporary file (e.g., *command > ~/whatever.tmp*), you can use *keep* to handle the temporary files for you (e.g., *command | keep*).
Keep is a command-line utility designed to manage temporary files created on the command line. Instead of redirecting output to a temporary file (e.g., =command > ~/whatever.tmp=), you can use =keep= to handle the temporary files for you (e.g., =command | keep=).
* Installation
To install Keep, you need to have Rust and Cargo installed on your system. You can then build and install Keep using the following commands:
@@ -18,82 +16,84 @@ cargo install --path .
Keep provides several subcommands to manage temporary files. Below are some examples of how to use Keep.
** Saving an Item
To save an item with tags and metadata, you can use the *--save* option:
To save an item with tags and metadata, you can use the =--save= option:
#+BEGIN_SRC sh
echo "Hello, world!" | keep --save --tag example --meta key=value
echo "Hello, world!" | keep --save example --meta key=value
#+END_SRC
** Getting an Item
To retrieve an item by its ID or by matching tags and metadata, you can use the *--get* option:
To retrieve an item by its ID or by matching tags and metadata, you can use the =--get= option:
#+BEGIN_SRC sh
keep --get 1
keep --get --tag example
keep --get example
keep --get --meta key=value
keep 1
keep example
#+END_SRC
** Listing Items
To list all items or filter them by tags and metadata, you can use the *--list* option:
To list all items or filter them by tags and metadata, you can use the =--list= option:
#+BEGIN_SRC sh
keep --list
keep --list --tag example
keep --list example
keep --list --meta key=value
#+END_SRC
** Updating an Item
To update an item's tags and metadata, you can use the *--update* option:
To update an item's tags and metadata, you can use the =--update= option:
#+BEGIN_SRC sh
keep --update 1 --tag newtag --meta key=newvalue
keep --update 1 newtag --meta key=newvalue
#+END_SRC
** Deleting an Item
To delete an item by its ID or by matching tags, you can use the *--delete* option:
To delete an item by its ID or by matching tags, you can use the =--delete= option:
#+BEGIN_SRC sh
keep --delete 1
keep --delete --tag example
keep --delete example
#+END_SRC
** Showing Status
To show the status of directories and supported compression algorithms, you can use the *--status* option:
To show the status of directories and supported compression algorithms, you can use the =--status= option:
#+BEGIN_SRC sh
keep --status
#+END_SRC
** Diffing Items
To show a diff between two items by ID, you can use the *--diff* option:
To show a diff between two items by ID, you can use the =--diff= option:
#+BEGIN_SRC sh
keep --diff 1 2
#+END_SRC
** Getting Information About an Item
To get detailed information about an item by its ID or by matching tags and metadata, you can use the *--info* option:
To get detailed information about an item by its ID or by matching tags and metadata, you can use the =--info= option:
#+BEGIN_SRC sh
keep --info 1
keep --info --tag example
keep --info example
keep --info --meta key=value
#+END_SRC
* Configuration
Keep can be configured using environment variables and command-line options. The following environment variables are supported:
- *KEEP_DIR*: Specify the directory to use for storage.
- *KEEP_LIST_FORMAT*: A comma-separated list of columns to display with *--list*.
- *KEEP_DIGEST*: Digest algorithm to use when saving items.
- *KEEP_COMPRESSION*: Compression algorithm to use when saving items.
- =KEEP_DIR=: Specify the directory to use for storage.
- =KEEP_LIST_FORMAT=: A comma-separated list of columns to display with =--list=.
- =KEEP_DIGEST=: Digest algorithm to use when saving items.
- =KEEP_COMPRESSION=: Compression algorithm to use when saving items.
* Examples
Here are some examples of how to use Keep with different options:
** Saving an Item with Compression and Digest
#+BEGIN_SRC sh
echo "Hello, world!" | keep --save --tag example --meta key=value --compression gzip --digest sha256
echo "Hello, world!" | keep --save example --meta key=value --compression gzip --digest sha256
#+END_SRC
** Getting an Item with Human-Readable Sizes
@@ -108,12 +108,12 @@ keep --list --list-format "id,time,size,tags,meta:hostname"
** Updating an Item with New Tags and Metadata
#+BEGIN_SRC sh
keep --update 1 --tag newtag --meta key=newvalue
keep --update 1 newtag --meta key=newvalue
#+END_SRC
** Deleting an Item by Tag
#+BEGIN_SRC sh
keep --delete --tag example
keep --delete example
#+END_SRC
** Showing Status with Verbose Output
@@ -128,7 +128,7 @@ keep --diff 1 2
** Getting Information About an Item with Metadata
#+BEGIN_SRC sh
keep --info 1 --meta key=value
keep --info 1
#+END_SRC
* License