lots of changes:

- added man command
- added unit tests
- fixed import+export file parameters (now -o and -r respectively)
- added README + License
- added ci pipelines
This commit is contained in:
2024-12-18 18:44:23 +01:00
parent 332eed679e
commit 83f818450c
20 changed files with 1225 additions and 24 deletions

17
t/files.txtar Normal file
View File

@@ -0,0 +1,17 @@
# simple file, we cannot use redirection here, so dd is our friend
exec dd if=/dev/random of=file.txt count=5 bs=10
# add file to db
exec anydb -f test.db set datum -r file.txt
# check for existence
exec anydb -f test.db get datum -o out.txt
exists out.txt
# check if its filled (50 bytes == count=5 x bs=10)
exec ls -l out.txt
stdout 50
# look if it's inside the db
exec anydb -f test.db ls
stdout datum.*binary-content

8
t/interface.txtar Normal file
View File

@@ -0,0 +1,8 @@
# check default outputs
exec anydb -v
stdout 'This is anydb version'
! exec anydb
stderr 'Available Commands:'

15
t/restore.txtar Normal file
View File

@@ -0,0 +1,15 @@
# setup simple db
exec anydb -f test.db set foo bar
# create backup
exec anydb -f test.db export -o backup.json
stdout 'database contents exported to backup.json'
# import into new db
exec anydb -f new.db import -r backup.json
stdout 'imported.*entries'
# check contents
exec anydb -f new.db list
stdout foo.*bar

50
t/workflow.txtar Normal file
View File

@@ -0,0 +1,50 @@
# simple entry
exec anydb -f test.db set foo bar
# entry with tags
exec anydb -f test.db set color grey -t flower,plant
# simple list
exec anydb -f test.db list
stdout foo.*bar
# wide list
exec anydb -f test.db list -o wide
stdout 'plant.*now.*grey'
# list tagged
exec anydb -f test.db list -t flower
! stdout bar
# list with filter
exec anydb -f test.db list b.r
stdout bar
# get single entry
exec anydb -f test.db get color
stdout grey
# modify
exec anydb -f test.db set foo blah
# check modified
exec anydb -f test.db get foo
stdout blah
# modify tagged
exec anydb -f test.db set color grey -t butterfly
# check modified tagged
exec anydb -f test.db list -t butterfly
stdout grey
# check modified tagged, make sure
exec anydb -f test.db list -t flower
! stdout grey
# delete entry
exec anydb -f test.db del foo
# check deleted
exec anydb -f test.db list
! stdout bar