2021-05-23 13:26:40 +02:00
|
|
|
import argparse
|
|
|
|
import configparser
|
|
|
|
|
2023-03-22 22:44:09 +01:00
|
|
|
from .ilias_common import ilias_common_load, configure_common_group_args
|
|
|
|
from .parser import CRAWLER_PARSER, SUBPARSERS, load_crawler
|
2021-05-26 10:52:04 +02:00
|
|
|
from ..logging import log
|
2023-03-22 22:44:09 +01:00
|
|
|
|
|
|
|
_PARSER_NAME = "kit-ilias-web"
|
2021-05-23 13:26:40 +02:00
|
|
|
|
|
|
|
SUBPARSER = SUBPARSERS.add_parser(
|
2023-03-22 22:44:09 +01:00
|
|
|
_PARSER_NAME,
|
2021-05-23 13:26:40 +02:00
|
|
|
parents=[CRAWLER_PARSER],
|
|
|
|
)
|
|
|
|
|
|
|
|
GROUP = SUBPARSER.add_argument_group(
|
2023-03-22 22:44:09 +01:00
|
|
|
title=f"{_PARSER_NAME} crawler arguments",
|
|
|
|
description=f"arguments for the '{_PARSER_NAME}' crawler",
|
2021-05-23 23:40:28 +02:00
|
|
|
)
|
2021-05-23 13:26:40 +02:00
|
|
|
|
2023-03-22 22:44:09 +01:00
|
|
|
configure_common_group_args(GROUP)
|
|
|
|
|
2021-05-23 13:26:40 +02:00
|
|
|
|
2023-03-22 22:44:09 +01:00
|
|
|
def load(args: argparse.Namespace, parser: configparser.ConfigParser) -> None:
|
|
|
|
log.explain(f"Creating config for command '{_PARSER_NAME}'")
|
2021-05-26 10:52:04 +02:00
|
|
|
|
2021-05-25 14:12:19 +02:00
|
|
|
parser["crawl:ilias"] = {}
|
|
|
|
section = parser["crawl:ilias"]
|
2021-05-23 13:26:40 +02:00
|
|
|
load_crawler(args, section)
|
|
|
|
|
2023-03-22 22:44:09 +01:00
|
|
|
section["type"] = _PARSER_NAME
|
2021-05-23 13:26:40 +02:00
|
|
|
|
2023-03-22 22:44:09 +01:00
|
|
|
ilias_common_load(section, args, parser)
|
2021-05-23 13:26:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
SUBPARSER.set_defaults(command=load)
|