Skip to content
Snippets Groups Projects
Commit 2027dd2a authored by Konstantin Baierer's avatar Konstantin Baierer
Browse files

Merge branch 'master' of https://github.com/kba/ocrd-kwalitee

parents c55b2a4a 6bd85bcd
No related branches found
No related tags found
No related merge requests found
import click import click
from pathlib import Path
from ocrd.decorators import ocrd_loglevel from ocrd.decorators import ocrd_loglevel
from ocrd_utils import getLogger from ocrd_utils import getLogger
from yaml import safe_load from yaml import safe_load
...@@ -66,8 +67,9 @@ def pull_all(ctx): ...@@ -66,8 +67,9 @@ def pull_all(ctx):
Generate JSON Generate JSON
''') ''')
@click.option('-o', '--output', help="Output file. Omit to print to STDOU")
@pass_ctx @pass_ctx
def generate_json(ctx): def generate_json(ctx, output=None):
ret = [] ret = []
_check_cloned(ctx) _check_cloned(ctx)
for repo in ctx.repos: for repo in ctx.repos:
...@@ -75,4 +77,8 @@ def generate_json(ctx): ...@@ -75,4 +77,8 @@ def generate_json(ctx):
repo.clone() repo.clone()
ret.append(repo.to_json()) ret.append(repo.to_json())
# print('%s %s -> %s' % (repo.path.is_dir(), repo.url, repo.path)) # print('%s %s -> %s' % (repo.path.is_dir(), repo.url, repo.path))
print(json.dumps(ret, indent=4, sort_keys=True)) json_str = json.dumps(ret, indent=4, sort_keys=True)
if output:
Path(output).write_text(json_str)
else:
print(json_str)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment