ghub/cli.py

22 lines
442 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-05 04:34:19 +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:
2021-11-05 04:19:09 +00:00
gh.load_user(user_name=user_name)
print(gh.repos_table())
2021-11-05 03:30:12 +00:00
except httpx.HTTPStatusError as e:
print(e)
2021-11-05 04:34:19 +00:00
2021-11-04 02:26:39 +00:00
if __name__ == "__main__":
main()