comparison env/lib/python3.9/site-packages/planemo/commands/cmd_list_repos.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
1 """Module describing the planemo ``list_repos`` command."""
2 from __future__ import print_function
3
4 import click
5
6 from planemo import options
7 from planemo.ci import print_as_yaml
8 from planemo.cli import command_function
9 from planemo.shed import (
10 _realize_effective_repositories,
11 find_raw_repositories,
12 )
13
14
15 @click.command('list_repos')
16 @options.shed_project_arg()
17 @options.ci_find_options()
18 @command_function
19 def cli(ctx, paths, **kwds):
20 """Find all shed repositories in one or more directories and output as yaml.
21
22 Currently, a shed repository is considered a directory with a .shed.yml
23 file.
24 """
25 kwds["recursive"] = True
26 kwds["fail_fast"] = True
27 repos = find_raw_repositories(ctx, paths, **kwds)
28 # Since fail_fast is True, all repos are actual raw repo objects and
29 # not exceptions.
30 raw_paths = [r.path for r in repos]
31 realized_repos = []
32 for repo_gen in (_realize_effective_repositories(r, path=p) for r, p in zip(repos, raw_paths)):
33 for repo in repo_gen:
34 realized_repos.append({'name': repo.config['name'], 'owner': repo.config['owner']})
35 print_as_yaml(realized_repos, **kwds)