import argparse import logging from pathlib import Path from typing import Any from personal_data.csv_import import load_csv_file logger = logging.getLogger(__name__) def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument( 'file', type=Path, ) parser.add_argument( 'output_file', type=Path, ) return parser.parse_args() def format_data_to_html(data: list[dict[str, Any]], mode: str = 'latest') -> str: sample = data[-1] l = [] l.append('') l.append('') for k, v in sample.items(): l.append(f'
{k}: {v}
') l.append('') l.append('') return ''.join(l) def main(): logging.basicConfig() logging.getLogger('git_time_tracker').setLevel('INFO') args = parse_arguments() # Load data data = load_csv_file(args.file) print(data) html = format_data_to_html(data) with open(args.output_file, 'w') as f: f.write(html) if __name__ == '__main__': main()