Skip to content

Allow --json and --markdown in repos command #500

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

Merged
merged 2 commits into from
May 1, 2025
Merged
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
3 changes: 2 additions & 1 deletion src/commands/repos/cmd-repos-create.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'

import { handleCreateRepo } from './handle-create-repo.mts'
import constants from '../../constants.mts'
import { commonFlags } from '../../flags.mts'
import { commonFlags, outputFlags } from '../../flags.mts'
import { checkCommandInput } from '../../utils/check-input.mts'
import { isTestingV1 } from '../../utils/config.mts'
import { determineOrgSlug } from '../../utils/determine-org-slug.mts'
Expand All @@ -21,6 +21,7 @@ const config: CliCommandConfig = {
hidden: false,
flags: {
...commonFlags,
...outputFlags,
defaultBranch: {
type: 'string',
shortFlag: 'b',
Expand Down
2 changes: 2 additions & 0 deletions src/commands/repos/cmd-repos-create.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ describe('socket repos create', async () => {
--help Print this help
--homepage Repository url
--interactive Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.
--json Output result as json
--markdown Output result as markdown
--org Force override the organization slug, overrides the default org from config
--repoDescription Repository description
--repoName Repository name
Expand Down
5 changes: 3 additions & 2 deletions src/commands/repos/cmd-repos-del.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'

import { handleDeleteRepo } from './handle-delete-repo.mts'
import constants from '../../constants.mts'
import { commonFlags } from '../../flags.mts'
import { commonFlags, outputFlags } from '../../flags.mts'
import { checkCommandInput } from '../../utils/check-input.mts'
import { isTestingV1 } from '../../utils/config.mts'
import { determineOrgSlug } from '../../utils/determine-org-slug.mts'
Expand All @@ -21,6 +21,7 @@ const config: CliCommandConfig = {
hidden: false,
flags: {
...commonFlags,
...outputFlags,
interactive: {
type: 'boolean',
default: true,
Expand Down Expand Up @@ -68,7 +69,7 @@ async function run(
})

const { dryRun, interactive, json, markdown, org: orgFlag } = cli.flags
const outputKind = getOutputKind(json, markdown) // TODO: impl json/md further
const outputKind = getOutputKind(json, markdown)

const [orgSlug, defaultOrgSlug] = await determineOrgSlug(
String(orgFlag || ''),
Expand Down
2 changes: 2 additions & 0 deletions src/commands/repos/cmd-repos-del.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ describe('socket repos del', async () => {
Options
--help Print this help
--interactive Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.
--json Output result as json
--markdown Output result as markdown
--org Force override the organization slug, overrides the default org from config

Examples
Expand Down
4 changes: 2 additions & 2 deletions src/commands/repos/cmd-repos-list.mts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const config: CliCommandConfig = {
hidden: false,
flags: {
...commonFlags,
...outputFlags,
sort: {
type: 'string',
shortFlag: 's',
Expand Down Expand Up @@ -54,8 +55,7 @@ const config: CliCommandConfig = {
shortFlag: 'p',
default: 1,
description: 'Page number'
},
...outputFlags
}
},
help: (command, config) => `
Usage
Expand Down
3 changes: 2 additions & 1 deletion src/commands/repos/cmd-repos-update.mts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { logger } from '@socketsecurity/registry/lib/logger'

import { handleUpdateRepo } from './handle-update-repo.mts'
import constants from '../../constants.mts'
import { commonFlags } from '../../flags.mts'
import { commonFlags, outputFlags } from '../../flags.mts'
import { checkCommandInput } from '../../utils/check-input.mts'
import { isTestingV1 } from '../../utils/config.mts'
import { determineOrgSlug } from '../../utils/determine-org-slug.mts'
Expand All @@ -21,6 +21,7 @@ const config: CliCommandConfig = {
hidden: false,
flags: {
...commonFlags,
...outputFlags,
defaultBranch: {
type: 'string',
shortFlag: 'b',
Expand Down
2 changes: 2 additions & 0 deletions src/commands/repos/cmd-repos-update.test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ describe('socket repos update', async () => {
--help Print this help
--homepage Repository url
--interactive Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.
--json Output result as json
--markdown Output result as markdown
--org Force override the organization slug, overrides the default org from config
--repoDescription Repository description
--repoName Repository name
Expand Down
Loading