Skip to content

Commit c1aefcb

Browse files
committed
Hide fix command
1 parent 1e03883 commit c1aefcb

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

src/cli.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ import { meowWithSubcommands } from './utils/meow-with-subcommands'
1616
const { rootPkgJsonPath } = constants
1717

1818
const formattedCliCommands = Object.fromEntries(
19-
Object.entries(cliCommands).map(entry => {
20-
const key = entry[0]
21-
entry[0] = camelToHyphen(key)
22-
return entry
23-
})
19+
Object.entries(cliCommands)
20+
.map(entry => {
21+
const key = entry[0]
22+
entry[0] = camelToHyphen(key)
23+
return entry
24+
})
2425
)
2526

2627
function camelToHyphen(str: string): string {

src/commands/fix.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const { SOCKET_CLI_FIX_PACKAGE_LOCK_FILE, SOCKET_IPC_HANDSHAKE } = constants
99

1010
export const fix: CliSubcommand = {
1111
description: 'Fix "fixable" Socket alerts',
12+
hidden: true,
1213
async run() {
1314
const spinner = new Spinner().start()
1415
try {

src/utils/meow-with-subcommands.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ type CliSubcommandRun = (
2222

2323
export interface CliSubcommand {
2424
description: string
25+
hidden?: boolean
2526
run: CliSubcommandRun
2627
}
2728

@@ -72,8 +73,18 @@ export async function meowWithSubcommands(
7273
Commands
7374
${getHelpListOutput(
7475
{
75-
...toSortedObject(subcommands),
76-
...toSortedObject(aliases)
76+
...toSortedObject(
77+
Object.fromEntries(
78+
Object.entries(subcommands)
79+
.filter(entry => !entry[1].hidden)
80+
)
81+
),
82+
...toSortedObject(
83+
Object.fromEntries(
84+
Object.entries(aliases)
85+
.filter(entry => !subcommands[entry[1]?.argv[0]!]?.hidden)
86+
)
87+
)
7788
},
7889
6
7990
)}

0 commit comments

Comments
 (0)