diff --git a/CHANGELOG.md b/CHANGELOG.md index e88ac98..b31774e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixed - Fix `--assignee self` to correctly resolve to current user ([#104](https://github.com/schpet/linear-cli/pull/104); thanks @JustTrott) +- issue list --web/--app now respects --team flag and works without workspace configured ### Added diff --git a/src/commands/issue/issue-list.ts b/src/commands/issue/issue-list.ts index fc6c311..256ec08 100644 --- a/src/commands/issue/issue-list.ts +++ b/src/commands/issue/issue-list.ts @@ -102,7 +102,7 @@ export const listCommand = new Command() ) => { const usePager = pager !== false if (web || app) { - await openTeamAssigneeView({ app: app }) + await openTeamAssigneeView({ app: app, team }) return } diff --git a/src/utils/actions.ts b/src/utils/actions.ts index 95684c5..c214b34 100644 --- a/src/utils/actions.ts +++ b/src/utils/actions.ts @@ -9,6 +9,8 @@ import { import { getOption } from "../config.ts" import { encodeBase64 } from "@std/encoding/base64" import { getNoIssueFoundMessage, startVcsWork } from "./vcs.ts" +import { gql } from "../__codegen__/gql.ts" +import { getGraphQLClient } from "./graphql.ts" export async function openIssuePage( providedId?: string, @@ -52,8 +54,10 @@ export async function openProjectPage( await open(url, options.app ? { app: { name: "Linear" } } : undefined) } -export async function openTeamAssigneeView(options: { app?: boolean } = {}) { - const teamId = getTeamKey() +export async function openTeamAssigneeView( + options: { app?: boolean; team?: string } = {}, +) { + const teamId = options.team ?? getTeamKey() if (!teamId) { console.error( "Could not determine team id from configuration or directory name.", @@ -61,12 +65,20 @@ export async function openTeamAssigneeView(options: { app?: boolean } = {}) { Deno.exit(1) } - const workspace = getOption("workspace") + let workspace = getOption("workspace") if (!workspace) { - console.error( - "workspace is not set via command line, configuration file, or environment.", - ) - Deno.exit(1) + const client = getGraphQLClient() + const viewerQuery = gql(` + query GetViewerWorkspace { + viewer { + organization { + urlKey + } + } + } + `) + const result = await client.request(viewerQuery) + workspace = result.viewer.organization.urlKey } const filterObj = {