Skip to content

Commit 0296077

Browse files
committed
Support --json in socket repos list
1 parent 216163f commit 0296077

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/commands/repos/list-repos.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,20 @@ export async function listRepos({
4848
return
4949
}
5050

51+
spinner.stop('')
52+
53+
if (outputJson) {
54+
const data = result.data.results.map(o => ({
55+
id: o.id,
56+
name: o.name,
57+
visibility: o.visibility,
58+
defaultBranch: o.default_branch,
59+
archived: o.archived
60+
}))
61+
console.log(JSON.stringify(data, null, 2))
62+
return
63+
}
64+
5165
const options = {
5266
columns: [
5367
{ field: 'id', name: colors.magenta('ID') },
@@ -58,5 +72,5 @@ export async function listRepos({
5872
]
5973
}
6074

61-
spinner.stop(chalkTable(options, result.data.results))
75+
console.log(chalkTable(options, result.data.results))
6276
}

0 commit comments

Comments
 (0)