-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
32 lines (29 loc) · 878 Bytes
/
cli.ts
File metadata and controls
32 lines (29 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env node
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import { applyCommand } from './commands/apply.js'
import { downloadCommand } from './commands/download.js'
import { listCommand } from './commands/list.js'
import { removeCommand } from './commands/remove.js'
import { gcCommand } from './commands/gc.js'
async function main(): Promise<void> {
await yargs(hideBin(process.argv))
.scriptName('socket-patch')
.usage('$0 <command> [options]')
.command(applyCommand)
.command(downloadCommand)
.command(listCommand)
.command(removeCommand)
.command(gcCommand)
.demandCommand(1, 'You must specify a command')
.help()
.alias('h', 'help')
.version()
.alias('v', 'version')
.strict()
.parse()
}
main().catch((error: Error) => {
console.error('Error:', error.message)
process.exit(1)
})