Last active
October 28, 2021 22:59
-
-
Save xiaopeng163/eb7979d8eacc706f949b2d5dc96f0205 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from github import Github | |
from rich.console import Console | |
from rich.table import Table | |
from rich import box | |
github_access_token = "ghp_****************************" | |
github_id = "xiaopeng163" | |
g = Github(github_access_token) | |
console = Console() | |
table = Table(box=box.SIMPLE, show_header=False) | |
table.width = None | |
table.add_column("full_name", justify="left") | |
table.add_column("description") | |
table.add_column("public", justify="left") | |
table.add_column("time", justify="left") | |
limit = 1 | |
for repo in g.get_user(github_id).get_repos(): | |
vis = "[yellow]private[/yellow]" if repo.private else "[green]public[/green]" | |
des = repo.description | |
if des: | |
des = des[:90] | |
table.add_row( | |
repo.raw_data["full_name"], des, vis, repo.created_at.strftime("%b %d, %Y") | |
) | |
if limit >= 30: | |
break | |
limit += 1 | |
console.print(table) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment