Add more documentation to README and inline

This commit is contained in:
Austen Adler 2018-08-15 00:08:13 -04:00
parent 355ec2b183
commit 1f1d8a0b83
2 changed files with 9 additions and 8 deletions

View file

@ -2,10 +2,9 @@
Needs [python-gnupg](https://pypi.python.org/pypi/python-gnupg). Run with path
to password store as argument.
The csv is written to `pass.csv`. The format for the KeePass Generic CSV
Importer is:
The csv is written to `pass.csv`. The format for KeePassXC importer is:
`Group(/),Title,Password,Notes`
`Group(/),Title,User,Password,URL,Notes`
Where 'Password' is the first line of the entry in `pass` and 'Notes' are all
subsequent lines. '\\' should not be interpreted as an escape character.

View file

@ -23,12 +23,14 @@ def traverse(path):
for name in files:
yield os.path.join(root, name)
def getMetadata(notes):
lines = notes.split('\n')
def getMetadata(notes_raw):
lines = notes_raw.split('\n')
# A list of lines to keep as notes (will be joined by newline)
ret = []
notes = []
# The extracted user field
user = ''
# The extracted URL field
url = ''
# This will extract each field name (for example, if a line in notes was `user: user1`, fields should contain 'user')
@ -64,9 +66,9 @@ def getMetadata(notes):
# The url was matched, don't add it to notes
continue
ret.append(line)
notes.append(line)
return (user, url, '\n'.join(ret).strip())
return (user, url, '\n'.join(notes).strip())
def parse(basepath, path, data):
name = os.path.splitext(os.path.basename(path))[0]