-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66201c4
commit 19f339a
Showing
16 changed files
with
3,266 additions
and
99 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
from pathlib import Path | ||
from typing import Annotated | ||
|
||
import typer | ||
from rich import print | ||
|
||
from codelimit.commands.upload import upload_command | ||
from codelimit.github_auth import device_flow_logout, device_flow_login | ||
|
||
app = typer.Typer(no_args_is_help=True) | ||
|
||
|
||
@app.command(help="Login to GitHub App") | ||
def login(): | ||
if device_flow_login(): | ||
print("[green]Logged in successfully[/green]") | ||
typer.Exit(code=0) | ||
else: | ||
print("[red]Login failed[/red]") | ||
typer.Exit(code=1) | ||
|
||
|
||
@app.command(help="Logout from GitHub App") | ||
def logout(): | ||
device_flow_logout() | ||
print("Logged out") | ||
|
||
|
||
@app.command(help="Upload report to Code Limit GitHub App") | ||
def upload( | ||
repository: Annotated[ | ||
str, | ||
typer.Argument( | ||
envvar="GITHUB_REPOSITORY", show_default=False, help="GitHub repository" | ||
), | ||
], | ||
branch: Annotated[ | ||
str, | ||
typer.Argument(envvar="GITHUB_REF", show_default=False, help="GitHub branch"), | ||
], | ||
report_file: Path = typer.Option( | ||
None, | ||
"--report", | ||
exists=True, | ||
dir_okay=False, | ||
file_okay=True, | ||
help="JSON report file", | ||
), | ||
token: str = typer.Option(None, "--token", help="GitHub access token"), | ||
url: str = typer.Option( | ||
"https://codelimit.vercel.app/api/upload", | ||
"--url", | ||
help="Upload JSON report to this URL.", | ||
), | ||
): | ||
upload_command(repository, branch, report_file, token, url) |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.