Skip to content

Commit 24fe62c

Browse files
ref(org): use shared list-command constants in org list (#273)
## Summary `org list` was the only list command not using the shared constants from `list-command.ts` that landed in #262. This switches it over. ## Changes - Replace inline `limit` and `json` flag definitions with `buildListLimitFlag("organizations")` and `LIST_JSON_FLAG` - Add `LIST_BASE_ALIASES` — gives `org list` the missing `-n` shorthand for `--limit`, consistent with all other list commands - Remove now-unused `numberParser` import from `command.ts` No behaviour change beyond the new `-n` alias. --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b52c33a commit 24fe62c

File tree

2 files changed

+8
-15
lines changed

2 files changed

+8
-15
lines changed

plugins/sentry-cli/skills/sentry-cli/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Work with Sentry organizations
110110
List organizations
111111

112112
**Flags:**
113-
- `--limit <value> - Maximum number of organizations to list - (default: "30")`
113+
- `-n, --limit <value> - Maximum number of organizations to list - (default: "30")`
114114
- `--json - Output JSON`
115115

116116
**Examples:**
@@ -605,7 +605,7 @@ List organizations
605605
List organizations
606606

607607
**Flags:**
608-
- `--limit <value> - Maximum number of organizations to list - (default: "30")`
608+
- `-n, --limit <value> - Maximum number of organizations to list - (default: "30")`
609609
- `--json - Output JSON`
610610

611611
### Projects

src/commands/org/list.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import type { SentryContext } from "../../context.js";
88
import { listOrganizations } from "../../lib/api-client.js";
9-
import { buildCommand, numberParser } from "../../lib/command.js";
9+
import { buildCommand } from "../../lib/command.js";
1010
import { DEFAULT_SENTRY_HOST } from "../../lib/constants.js";
1111
import { getAllOrgRegions } from "../../lib/db/regions.js";
1212
import {
@@ -15,6 +15,7 @@ import {
1515
writeFooter,
1616
writeJson,
1717
} from "../../lib/formatters/index.js";
18+
import { buildListLimitFlag, LIST_JSON_FLAG } from "../../lib/list-command.js";
1819

1920
type ListFlags = {
2021
readonly limit: number;
@@ -69,19 +70,11 @@ export const listCommand = buildCommand({
6970
},
7071
parameters: {
7172
flags: {
72-
limit: {
73-
kind: "parsed",
74-
parse: numberParser,
75-
brief: "Maximum number of organizations to list",
76-
// Stricli requires string defaults (raw CLI input); numberParser converts to number
77-
default: "30",
78-
},
79-
json: {
80-
kind: "boolean",
81-
brief: "Output JSON",
82-
default: false,
83-
},
73+
limit: buildListLimitFlag("organizations"),
74+
json: LIST_JSON_FLAG,
8475
},
76+
// Only -n for --limit; no -c since org list has no --cursor flag
77+
aliases: { n: "limit" },
8578
},
8679
async func(this: SentryContext, flags: ListFlags): Promise<void> {
8780
const { stdout } = this;

0 commit comments

Comments
 (0)