Skip to content

Instantly share code, notes, and snippets.

@arturtamborski
Created May 17, 2024 13:32
Show Gist options
  • Save arturtamborski/9582a367959a7914b869c1a8dff0e3c6 to your computer and use it in GitHub Desktop.
Save arturtamborski/9582a367959a7914b869c1a8dff0e3c6 to your computer and use it in GitHub Desktop.
benedict
import pathlib
from benedict import benedict
import json
out = benedict(keypath_separator='/')
for file in pathlib.Path('gopass').rglob('*.gpg'):
path = str(file).removeprefix('gopass/').removesuffix('.gpg')
out[path] = {}
print(
json.dumps(out, indent=4, sort_keys=True)
.replace('"', '')
.replace(',', '')
.replace('"', '')
.replace(':', ' =')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment