#!/usr/local/src/gridfire/keepassxc_cmd2/keepassxc_cmd2.py
# -*- mode: sh; tab-width: 8; encoding: utf-8-unix -*-

set debug true

shell rm -f /var/tmp/test4.xml
shell cp /var/tmp/test4.kdbx  /var/tmp/kpy4.kdbx 

get_kdbx /var/tmp/kpy4.kdbx
get_keyfile /var/tmp/test4.key
get_pass password

kpy open

# properties
kpy attachments
kpy binaries
kpy encryption_algorithm
kpy filename
kpy groups
kpy kdf_algorithm
kpy keyfile
kpy version

# destination_group, group_name
kpy add_group email Email
# destination_group, title, username,assword, url=None, notes=None,
## AttributeError: 'str' object has no attribute '_element'
kpy add_entry email/gmail Gmail foo password url=http://goo.gl notes=""
# KGFbaSozMjppKjMyKzMxXS5yZXBsYWNlKHMsJycpLmVuY29kZSgpKQ
kpy add_binary_base64 AAAAAAAAAAAAAAAAAAAAAA==
kpy binaries
kpy get_binary_base64 0
kpy delete_binary 0
kpy binaries

kpy _xpath /KeePassFile/Meta/Generator
# KeePass
kpy _xpath /KeePassFile/Meta/RecycleBinEnabled
# True
kpy _xpath /KeePassFile/Root/Group/UUID
# o0mwbJwv11og+n6KjBcVjw==

# kpy root_group
# kpy tree
# kpy xml

kpy save

kpy dump_xml /var/tmp/test4.xml
shell ls -l  /var/tmp/test4.xml

kpy eval 1+1
kpy eval [ x for x in dir(oKP) if not x.startswith('_')]
kpy close

# set sPassword
set sKeyfile
set sKdbx

help
#help cli
#help kpy
