Coverage for export_files.py: 76%
17 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-04 21:22 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-04 21:22 +0000
1"""Export files for students."""
3import sys
4from argparse import Namespace
6from sel_tools.file_export.copy_item import copy_item
7from sel_tools.file_export.export_item import visit_exported_item
8from sel_tools.utils import args
11def parse_arguments(arguments: list[str]) -> Namespace:
12 """Parse CLI arguments."""
13 factory = args.ArgumentParserFactory.default_parser(__doc__)
14 factory.parser.add_argument(
15 "source_path",
16 type=args.dir_path,
17 help="Path to the source files",
18 )
19 factory.add_output_path()
20 factory.add_keep_solutions()
22 return factory.parser.parse_args(arguments[1:])
25def main() -> None:
26 """main."""
27 arguments = parse_arguments(sys.argv)
29 copy_item(arguments.source_path, arguments.output_dir)
30 visit_exported_item(arguments.output_dir, arguments.keep_solutions)
33if __name__ == "__main__":
34 main()