Added --json to dump command

This commit is contained in:
Rhet Turnbull
2019-12-22 08:15:21 -08:00
parent 8ee8a38f0f
commit 2a5f0a2299

View File

@@ -123,12 +123,19 @@ def info(cli_obj):
@cli.command() @cli.command()
@click.option(
"--json",
required=False,
is_flag=True,
default=False,
help="Print output in JSON format.",
)
@click.pass_obj @click.pass_obj
def dump(cli_obj): def dump(cli_obj, json):
""" Print list of all photos & associated info from the Photos library. """ """ Print list of all photos & associated info from the Photos library. """
pdb = osxphotos.PhotosDB(dbfile=cli_obj.db) pdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
photos = pdb.photos() photos = pdb.photos()
print_photo_info(photos, cli_obj.json) print_photo_info(photos, cli_obj.json or json)
@cli.command(name="list") @cli.command(name="list")