forked from hrgdavor/jsx6
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.js
More file actions
25 lines (20 loc) · 625 Bytes
/
Copy pathcli.js
File metadata and controls
25 lines (20 loc) · 625 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
import { parseArgs } from 'util'
function printHelp() {
console.log(`This is a sample script
--mode= script mode of operation
-v --verbose verbose output
--help to get this help screen
`)
process.exit(0)
}
const {
values: { v, verbose: isVerbose = v, help, mode = 'default' },
positionals: [bunPath, scriptPath, ...args],
} = parseArgs({ args: Bun.argv, strict: false })
if (help) printHelp()
if (isVerbose) {
console.log('some verbose output')
console.log('bunPath', bunPath)
console.log('scriptPath', scriptPath)
}
console.log(`running script in ${mode} mode, and args:`, args)