Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add command triage #10

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion linear/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,15 @@
import click

from . import console
from .client import get_me, get_team, get_issue, ISSUE_STATES
from .client import (
get_me,
get_team,
get_issue,
ISSUE_STATES,
get_triage_issues,
get_custom_views,
get_favorites,
)

LINEAR_API_KEY = os.environ["LINEAR_API_KEY"]
LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -168,6 +176,28 @@ def cmd_ls(state: str, json: bool):
console.print_issues(issues, format)


@click.command("triage")
@click.option("--json", is_flag=True)
def cmd_triage(json: bool):
"""
List linear issues that are in triage for the different "projects"/"grouping"
"""
me = get_me()
if not me.teams:
LOGGER.error("You are not a member of any teams")
sys.exit(1)

triage_issues = [
issue
for team in me.teams
for issue in get_team(team.id).issues
if issue.state.type == "triage"
]

for issue in triage_issues:
console.print_issue(issue, "json" if json else "markdown")


@click.group()
def cli():
setup_logging()
Expand All @@ -177,5 +207,6 @@ def cli():
cli.add_command(cmd_team)
cli.add_command(cmd_me)
cli.add_command(cmd_ls)
cli.add_command(cmd_triage)
if __name__ == "__main__":
cli()
Loading