@@ -7,48 +7,67 @@ import { checkCommandInput } from '../../utils/check-input.mts'
77import { determineOrgSlug } from '../../utils/determine-org-slug.mts'
88import { getOutputKind } from '../../utils/get-output-kind.mts'
99import { meowOrExit } from '../../utils/meow-with-subcommands.mts'
10- import { getFlagListOutput } from '../../utils/output-formatting.mts'
10+ import {
11+ getFlagApiRequirementsOutput ,
12+ getFlagListOutput ,
13+ } from '../../utils/output-formatting.mts'
1114import { hasDefaultToken } from '../../utils/sdk.mts'
1215
1316import type { CliCommandConfig } from '../../utils/meow-with-subcommands.mts'
1417
1518const { DRY_RUN_BAILING_NOW , SOCKET_WEBSITE_URL } = constants
1619
17- const config : CliCommandConfig = {
18- commandName : 'audit-log' ,
19- description : 'Look up the audit log for an organization' ,
20- hidden : false ,
21- flags : {
22- ...commonFlags ,
23- ...outputFlags ,
24- interactive : {
25- type : 'boolean' ,
26- default : true ,
27- description :
28- 'Allow for interactive elements, asking for input. Use --no-interactive to prevent any input questions, defaulting them to cancel/no.' ,
29- } ,
30- org : {
31- type : 'string' ,
32- description :
33- 'Force override the organization slug, overrides the default org from config' ,
34- } ,
35- page : {
36- type : 'number' ,
37- description : 'Result page to fetch' ,
38- } ,
39- perPage : {
40- type : 'number' ,
41- default : 30 ,
42- description : 'Results per page - default is 30' ,
20+ const CMD_NAME = 'audit-log'
21+
22+ const description = 'Look up the audit log for an organization'
23+
24+ const hidden = false
25+
26+ export const cmdAuditLog = {
27+ description,
28+ hidden,
29+ run,
30+ }
31+
32+ async function run (
33+ argv : string [ ] | readonly string [ ] ,
34+ importMeta : ImportMeta ,
35+ { parentName } : { parentName : string } ,
36+ ) : Promise < void > {
37+ const config : CliCommandConfig = {
38+ commandName : CMD_NAME ,
39+ description,
40+ hidden,
41+ flags : {
42+ ...commonFlags ,
43+ ...outputFlags ,
44+ interactive : {
45+ type : 'boolean' ,
46+ default : true ,
47+ description :
48+ 'Allow for interactive elements, asking for input.\nUse --no-interactive to prevent any input questions, defaulting them to cancel/no.' ,
49+ } ,
50+ org : {
51+ type : 'string' ,
52+ description :
53+ 'Force override the organization slug, overrides the default org from config' ,
54+ } ,
55+ page : {
56+ type : 'number' ,
57+ description : 'Result page to fetch' ,
58+ } ,
59+ perPage : {
60+ type : 'number' ,
61+ default : 30 ,
62+ description : 'Results per page - default is 30' ,
63+ } ,
4364 } ,
44- } ,
45- help : ( command , config ) => `
65+ help : ( command , config ) => `
4666 Usage
4767 $ ${ command } [options] [FILTER]
4868
4969 API Token Requirements
50- - Quota: 1 unit
51- - Permissions: audit-log:list
70+ ${ getFlagApiRequirementsOutput ( `${ parentName } :${ CMD_NAME } ` ) }
5271
5372 This feature requires an Enterprise Plan. To learn more about getting access
5473 to this feature and many more, please visit ${ SOCKET_WEBSITE_URL } /pricing
@@ -72,19 +91,8 @@ const config: CliCommandConfig = {
7291 $ ${ command }
7392 $ ${ command } deleteReport --page 2 --perPage 10
7493 ` ,
75- }
76-
77- export const cmdAuditLog = {
78- description : config . description ,
79- hidden : config . hidden ,
80- run,
81- }
94+ }
8295
83- async function run (
84- argv : string [ ] | readonly string [ ] ,
85- importMeta : ImportMeta ,
86- { parentName } : { parentName : string } ,
87- ) : Promise < void > {
8896 const cli = meowOrExit ( {
8997 argv,
9098 config,
0 commit comments