Changeset View
Changeset View
Standalone View
Standalone View
swh/scanner/cli.py
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | @click.option( | ||||
help="The output format", | help="The output format", | ||||
) | ) | ||||
@click.option( | @click.option( | ||||
"-i", "--interactive", is_flag=True, help="Show the result in a dashboard" | "-i", "--interactive", is_flag=True, help="Show the result in a dashboard" | ||||
) | ) | ||||
@click.option( | @click.option( | ||||
"-p", | "-p", | ||||
"--policy", | "--policy", | ||||
default="bfs", | default="auto", | ||||
show_default=True, | show_default=True, | ||||
type=click.Choice(["bfs", "filepriority", "dirpriority"]), | type=click.Choice(["auto", "bfs", "filepriority", "dirpriority"]), | ||||
help="The scan policy.", | help="The scan policy.", | ||||
) | ) | ||||
@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): | ||||
"""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 | |||||
using the -p/--policy option: | |||||
auto: it selects the best policy based on the source code, for codebase(s) 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. | |||||
filepriority: scan all the source code file contents, checking only unset | |||||
directories. (useful if the codebase contains a lot of source files) | |||||
dirpriority: scan all the source code directories and check only unknown | |||||
directory contents. | |||||
""" | |||||
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) | scanner.scan(config, root_path, patterns, out_fmt, interactive, policy) | ||||
@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 | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |