ghub/cli.py

21 lines
474 B
Python
Raw Normal View History

2021-11-04 05:01:35 +00:00
from ghub import GHub
from rich.prompt import Prompt
from rich import print
2021-11-04 02:26:39 +00:00
import httpx
2021-11-05 02:59:03 +00:00
import os
2021-11-04 02:26:39 +00:00
2021-11-04 05:01:35 +00:00
def main():
2021-11-05 02:59:03 +00:00
if not os.environ.get("GITHUB_TOKEN"):
raise Exception("Please set GITHUB_TOKEN")
2021-11-04 05:01:35 +00:00
user_name = Prompt.ask("Username?")
gh = GHub()
2021-11-05 03:30:12 +00:00
try:
success = gh.load_user(user_name=user_name)
if success:
print(gh.repos_table())
except httpx.HTTPStatusError as e:
print(e)
2021-11-04 02:26:39 +00:00
if __name__ == "__main__":
main()