Skip to content

Commit a06eb7d

Browse files
committed
Cleanup checkCommandInput
1 parent 9848a8f commit a06eb7d

37 files changed

Lines changed: 13 additions & 115 deletions

src/commands/analytics/cmd-analytics.mts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,12 @@ async function run(
111111
nook: true,
112112
test: noLegacy,
113113
message: 'Legacy flags are no longer supported. See v1 migration guide.',
114-
pass: 'ok',
115114
fail: `received legacy flags`,
116115
},
117116
{
118117
nook: true,
119118
test: scope === 'org' || !!repoName,
120119
message: 'When scope=repo, repo name should be the second argument',
121-
pass: 'ok',
122120
fail: 'missing',
123121
},
124122
{
@@ -127,37 +125,32 @@ async function run(
127125
scope === 'org' ||
128126
(repoName !== '7' && repoName !== '30' && repoName !== '90'),
129127
message: 'When scope is repo, the second arg should be repo, not time',
130-
pass: 'ok',
131128
fail: 'missing',
132129
},
133130
{
134131
test: time === '7' || time === '30' || time === '90',
135132
message: 'The time filter must either be 7, 30 or 90',
136-
pass: 'ok',
137133
fail: 'invalid range set, see --help for command arg details.',
138134
},
139135
{
140136
nook: true,
141137
test: !file || !!json || !!markdown,
142138
message:
143139
'The `--file` flag is only valid when using `--json` or `--markdown`',
144-
pass: 'ok',
145140
fail: 'bad',
146141
},
147142
{
148143
nook: true,
149144
test: !json || !markdown,
150145
message:
151146
'The `--json` and `--markdown` flags can not be used at the same time',
152-
pass: 'ok',
153147
fail: 'bad',
154148
},
155149
{
156150
nook: true,
157151
test: hasApiToken,
158152
message:
159153
'You need to be logged in to use this command. See `socket login`.',
160-
pass: 'ok',
161154
fail: 'missing Socket API token',
162155
},
163156
)

src/commands/audit-log/cmd-audit-log.mts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,37 +123,32 @@ async function run(
123123
nook: true,
124124
test: noLegacy,
125125
message: 'Legacy flags are no longer supported. See v1 migration guide.',
126-
pass: 'ok',
127126
fail: `received legacy flags`,
128127
},
129128
{
130129
nook: true,
131130
test: !!orgSlug,
132131
message: 'Org name by default setting, --org, or auto-discovered',
133-
pass: 'ok',
134132
fail: 'missing',
135133
},
136134
{
137135
nook: true,
138136
test: hasApiToken,
139137
message:
140138
'You need to be logged in to use this command. See `socket login`.',
141-
pass: 'ok',
142139
fail: 'missing Socket API token',
143140
},
144141
{
145142
nook: true,
146143
test: !json || !markdown,
147144
message:
148145
'The `--json` and `--markdown` flags can not be used at the same time',
149-
pass: 'ok',
150146
fail: 'bad',
151147
},
152148
{
153149
nook: true,
154150
test: /^[a-zA-Z]*$/.test(typeFilter),
155151
message: 'The filter must be an a-zA-Z string, it is an enum',
156-
pass: 'ok',
157152
fail: 'it was given but not a-zA-Z',
158153
},
159154
)

src/commands/config/cmd-config-auto.mts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,13 @@ ${getSupportedConfigEntries()
7777
{
7878
test: key !== 'test' && isSupportedConfigKey(key),
7979
message: 'Config key should be the first arg',
80-
pass: 'ok',
8180
fail: key ? 'invalid config key' : 'missing',
8281
},
8382
{
8483
nook: true,
8584
test: !json || !markdown,
8685
message:
8786
'The `--json` and `--markdown` flags can not be used at the same time',
88-
pass: 'ok',
8987
fail: 'bad',
9088
},
9189
)

src/commands/config/cmd-config-get.mts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,13 @@ async function run(
7575
{
7676
test: key === 'test' || isSupportedConfigKey(key),
7777
message: 'Config key should be the first arg',
78-
pass: 'ok',
7978
fail: key ? 'invalid config key' : 'missing',
8079
},
8180
{
8281
nook: true,
8382
test: !json || !markdown,
8483
message:
8584
'The `--json` and `--markdown` flags can not be used at the same time',
86-
pass: 'ok',
8785
fail: 'bad',
8886
},
8987
)

src/commands/config/cmd-config-list.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ async function run(
6464
test: !json || !markdown,
6565
message:
6666
'The `--json` and `--markdown` flags can not be used at the same time',
67-
pass: 'ok',
6867
fail: 'bad',
6968
})
7069
if (!wasValidInput) {

src/commands/config/cmd-config-set.mts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,22 +86,19 @@ ${getSupportedConfigEntries()
8686
{
8787
test: key === 'test' || isSupportedConfigKey(key),
8888
message: 'Config key should be the first arg',
89-
pass: 'ok',
9089
fail: key ? 'invalid config key' : 'missing',
9190
},
9291
{
9392
test: !!value, // This is a string, empty string is not ok
9493
message:
9594
'Key value should be the remaining args (use `unset` to unset a value)',
96-
pass: 'ok',
9795
fail: 'missing',
9896
},
9997
{
10098
nook: true,
10199
test: !json || !markdown,
102100
message:
103101
'The `--json` and `--markdown` flags can not be used at the same time',
104-
pass: 'ok',
105102
fail: 'bad',
106103
},
107104
)

src/commands/config/cmd-config-unset.mts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,13 @@ ${getSupportedConfigEntries()
7878
{
7979
test: key === 'test' || isSupportedConfigKey(key),
8080
message: 'Config key should be the first arg',
81-
pass: 'ok',
8281
fail: key ? 'invalid config key' : 'missing',
8382
},
8483
{
8584
nook: true,
8685
test: !json || !markdown,
8786
message:
8887
'The `--json` and `--markdown` flags can not be used at the same time',
89-
pass: 'ok',
9088
fail: 'bad',
9189
},
9290
)

src/commands/fix/cmd-fix.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ async function run(
174174
const wasValidInput = checkCommandInput(outputKind, {
175175
test: RangeStyles.includes(rangeStyle),
176176
message: `Expecting range style of ${joinOr(RangeStyles)}`,
177-
pass: 'ok',
178177
fail: 'invalid',
179178
})
180179
if (!wasValidInput) {

src/commands/manifest/cmd-manifest-conda.mts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,15 +157,13 @@ async function run(
157157
nook: true,
158158
test: cli.input.length <= 1,
159159
message: 'Can only accept one DIR (make sure to escape spaces!)',
160-
pass: 'ok',
161160
fail: `received ${cli.input.length}`,
162161
},
163162
{
164163
nook: true,
165164
test: !json || !markdown,
166165
message:
167166
'The `--json` and `--markdown` flags can not be used at the same time',
168-
pass: 'ok',
169167
fail: 'bad',
170168
},
171169
)

src/commands/manifest/cmd-manifest-gradle.mts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ async function run(
147147
nook: true,
148148
test: cli.input.length <= 1,
149149
message: 'Can only accept one DIR (make sure to escape spaces!)',
150-
pass: 'ok',
151150
fail: 'received ' + cli.input.length,
152151
})
153152
if (!wasValidInput) {

0 commit comments

Comments
 (0)