/
Doggich
/
CodeRepresentation
Обзор
Документация
Войти
/
Doggich
/
CodeRepresentation
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/modules/main.py
52 строки
2 KB
Doggich
refactoring: script structure
10 янв 2026, 19:23
10 янв 2026, 19:23
6336d86
Код
Авторство
О чём код?
import os import sys import time from datetime import datetime from modules.argsParser import build_arg_parser from modules.gitURLParser import parse_github_url from modules.repoExporter import GitHubRepoExporter def main(): """ Main function to parse command line arguments and export a GitHub repository. Usage: python script.py https://github.com/owner/repository [--token TOKEN] [--output FILENAME] Examples: python script.py https://github.com/Doggich/DemoSceneEffect python script.py https://github.com/Doggich/DemoSceneEffect --token ghp_your_token_here python script.py https://github.com/Doggich/DemoSceneEffect --output my_repo.txt """ # Parse command line arguments parser = build_arg_parser() args = parser.parse_args() # Set default output filename if not provided if args.output_file is None: args.output_file = f"repository_content_{datetime.now().strftime('%Y%m%d%H%M%S')}.txt" try: # Parse the GitHub URL owner, repo = parse_github_url(args.url) print(f"Exporting repository: {owner}/{repo}") if args.token: print("Using GitHub token for authentication") print(f"Output file: {args.output_file}") print("-" * 50) # Create exporter and start export exporter = GitHubRepoExporter(owner, repo, args.token) exporter.explore_repository(output_file=args.output_file) # Show absolute path to output file abs_path = os.path.abspath(args.output_file) print(f"\nOutput file location: {abs_path}") except ValueError as e: print(f"Error: {e}") sys.exit(1) except Exception as e: print(f"Unexpected error: {e}") sys.exit(1)