Skip to content

Commit

Permalink
Updated example to make space for --csv, refs #6
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Nov 12, 2021
1 parent 772c0c0 commit 6d4d13c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,20 @@ You would run the tool like this:
--id id \
--convert 'json.loads(content)["incidents"]'

If you need to import additional modules you can do so with `--import`, for example:
If you need to import additional modules you can do so with `--import`. This example shows how you could read a CSV file that uses `;` as the delimiter:

git-history file trees.db ../sf-tree-history/Street_Tree_List.csv \
--repo ../sf-tree-history \
--import csv \
--import io \
--convert 'list(csv.DictReader(io.StringIO(content.decode("utf-8"))))' \
--convert '
fp = io.StringIO(content.decode("utf-8"))
return list(csv.DictReader(fp, delimiter=";"))
' \
--id TreeID

If your Python code spans more than one line it needs to include a `return` statement.

## Development

To contribute to this tool, first checkout the code. Then create a new virtual environment:
Expand Down

0 comments on commit 6d4d13c

Please sign in to comment.