Add since command #7

Merged
torjus merged 2 commits from 6-commits-since into master 2024-10-06 17:44:54 +00:00
Showing only changes of commit de64f73c46 - Show all commits

View File

@ -1,7 +1,9 @@
import typer
import json
from typing import Annotated
from rich.console import Console
from nixprstatus.pr import pr_merge_status
from nixprstatus.pr import commits_since
app = typer.Typer()
@ -38,6 +40,26 @@ def pr(
console.print(output, highlight=False)
@app.command()
def since(
commit_sha: str,
target: str = "nixos-unstable",
waybar_format: Annotated[
bool, typer.Option(help="Output in format expected by waybar")
] = False,
):
"""
Return the count of commits that has happened between the two refs.
"""
count = commits_since(target, commit_sha)
if waybar_format:
output = {"text": str(count), "tooltip": f"{target}: {count}"}
typer.echo(json.dumps(output))
return
typer.echo(count)
def main():
app()