-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.py
executable file
·47 lines (39 loc) · 1.34 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import click
from kcidev.libs.common import *
from kcidev.subcommands import checkout, commit, patch, results, testretry
@click.group(
help="Stand alone tool for Linux Kernel developers and maintainers that can test local Linux Kernel changes on a enabled KernelCI server"
)
@click.version_option("0.1.0", prog_name="kci-dev")
@click.option(
"--settings",
default=".kci-dev.toml",
help="Local settings file to use",
required=False,
)
@click.option("--instance", help="API instance to use", required=False)
@click.pass_context
def cli(ctx, settings, instance):
ctx.obj = {"CFG": load_toml(settings)}
if instance:
ctx.obj["INSTANCE"] = instance
else:
ctx.obj["INSTANCE"] = ctx.obj["CFG"].get("default_instance")
if not ctx.obj["INSTANCE"]:
click.secho("No instance defined in settings or as argument", fg="red")
raise click.Abort()
if ctx.obj["INSTANCE"] not in ctx.obj["CFG"]:
click.secho(f"Instance {ctx.obj['INSTANCE']} not found in {settings}", fg="red")
raise click.Abort()
pass
def run():
cli.add_command(checkout.checkout)
cli.add_command(commit.commit)
cli.add_command(patch.patch)
cli.add_command(results.results)
cli.add_command(testretry.testretry)
cli()
if __name__ == "__main__":
run()