Coverage for export_files.py: 76%

17 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-04 21:22 +0000

1"""Export files for students.""" 

2 

3import sys 

4from argparse import Namespace 

5 

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 

9 

10 

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() 

21 

22 return factory.parser.parse_args(arguments[1:]) 

23 

24 

25def main() -> None: 

26 """main.""" 

27 arguments = parse_arguments(sys.argv) 

28 

29 copy_item(arguments.source_path, arguments.output_dir) 

30 visit_exported_item(arguments.output_dir, arguments.keep_solutions) 

31 

32 

33if __name__ == "__main__": 

34 main()