Changeset View
Changeset View
Standalone View
Standalone View
swh/scanner/cli.py
Show First 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | |||||
@click.option( | @click.option( | ||||
"-p", | "-p", | ||||
"--policy", | "--policy", | ||||
default="auto", | default="auto", | ||||
show_default=True, | show_default=True, | ||||
type=click.Choice(["auto", "bfs", "greedybfs", "filepriority", "dirpriority"]), | type=click.Choice(["auto", "bfs", "greedybfs", "filepriority", "dirpriority"]), | ||||
help="The scan policy.", | help="The scan policy.", | ||||
) | ) | ||||
@click.option( | |||||
"-e", | |||||
"--extra-info", | |||||
zack: I see that "-i" is already taken, hence why you haven't used it.
I think that "a" is not very… | |||||
"extra_info", | |||||
multiple=True, | |||||
type=click.Choice(["origin"]), | |||||
Not Done Inline ActionsCould you describe the extra info? vlorentz: Could you describe the extra info? | |||||
Not Done Inline Actionsbetter: "add selected additional information about known software artifacts" zack: better: "add selected additional information about known software artifacts" | |||||
help="Add selected additional information about known software artifacts.", | |||||
) | |||||
@click.pass_context | @click.pass_context | ||||
def scan(ctx, root_path, api_url, patterns, out_fmt, interactive, policy): | def scan(ctx, root_path, api_url, patterns, out_fmt, interactive, policy, extra_info): | ||||
"""Scan a source code project to discover files and directories already | """Scan a source code project to discover files and directories already | ||||
present in the archive. | present in the archive. | ||||
The source code project can be checked using different policies that can be set | The source code project can be checked using different policies that can be set | ||||
using the -p/--policy option: | using the -p/--policy option:\n | ||||
\b | |||||
auto: it selects the best policy based on the source code, for codebase(s) with | auto: it selects the best policy based on the source code, for codebase(s) | ||||
less than 1000 file/dir contents all the nodes will be queried. | with less than 1000 file/dir contents all the nodes will be queried. | ||||
bfs: scan the source code in the BFS order, checking unknown directories only. | bfs: scan the source code in the BFS order, checking unknown directories only. | ||||
greedybfs: same as "bfs" policy, but lookup the status of source code artifacts in | \b | ||||
chunks, in order to minimize the number of Web API round-trips with the archive. | greedybfs: same as "bfs" policy, but lookup the status of source code artifacts | ||||
in chunks, in order to minimize the number of Web API round-trips with the | |||||
archive. | |||||
\b | |||||
filepriority: scan all the source code file contents, checking only unset | filepriority: scan all the source code file contents, checking only unset | ||||
directories. (useful if the codebase contains a lot of source files) | directories. (useful if the codebase contains a lot of source files) | ||||
dirpriority: scan all the source code directories and check only unknown | dirpriority: scan all the source code directories and check only unknown | ||||
directory contents. | directory contents. | ||||
Other information about software artifacts could be specified with the -a/--add | |||||
Not Done Inline Actionsthis should be -e/--extra-info now zack: this should be -e/--extra-info now | |||||
option:\n | |||||
\b | |||||
origin: search the origin url of each source code files/dirs using the in-memory | |||||
compressed graph. | |||||
""" | """ | ||||
import swh.scanner.scanner as scanner | import swh.scanner.scanner as scanner | ||||
config = setup_config(ctx, api_url) | config = setup_config(ctx, api_url) | ||||
scanner.scan(config, root_path, patterns, out_fmt, interactive, policy) | extra_info = set(extra_info) | ||||
scanner.scan(config, root_path, patterns, out_fmt, interactive, policy, extra_info) | |||||
@scanner.group("db", help="Manage local knowledge base for swh-scanner") | @scanner.group("db", help="Manage local knowledge base for swh-scanner") | ||||
@click.pass_context | @click.pass_context | ||||
def db(ctx): | def db(ctx): | ||||
pass | pass | ||||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |
I see that "-i" is already taken, hence why you haven't used it.
I think that "a" is not very mnemonic though, I propose to use "e" (for extra) info, that is: "-e", "--extra-info", "extra_info)