-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
36 lines (25 loc) · 1.29 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os.path
from fastapi import FastAPI
import typer
import analysis_repository
import book_generator
app = typer.Typer()
@app.command()
def analyse(repo_path: str, is_private: str = 'false', branch: str = 'master', file_extension='java',
language: str = 'en'):
client_public = analysis_repository.GitHubClient(url="https://api.github.com")
is_private = is_private.lower() == 'true'
client_public.get_repo(repo_path, is_private=is_private,
branch=branch) # replace with the public repo you want to download
# replace with the repo you want to download
# client_private = GitHubClient(url="https://api.github.com", token="your_github_token")
# client_private.get_repo("username/private-repo") # replace with the private repo you want to download
dir_path = os.path.join("./downloaded_sources/", repo_path + "-" + branch)
analysis_repo = analysis_repository.AnalysisRepository(dir_path=dir_path, file_extension=file_extension, language=language)
analysis_repo.ask()
@app.command()
def book(input_dir: str, output_dir: str = "./book", project_name: str = "MyProject"):
# Generate a book from the explanations
book_generator.generate_sphinx_project(input_dir, output_dir, project_name)
if __name__ == "__main__":
app()