-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.cli.ts
41 lines (36 loc) · 1.12 KB
/
index.cli.ts
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
33
34
35
36
37
38
39
40
41
#!/usr/bin/env node
/**
* @file This file is part of the Keywork project.
* @copyright Nirrius, LLC. All rights reserved.
* @author Teffen Ellis, et al.
* @license AGPL-3.0
*
* @remarks Keywork is free software for non-commercial purposes.
* You can be released from the requirements of the license by purchasing a commercial license.
* Buying such a license is mandatory as soon as you develop commercial activities
* involving the Keywork software without disclosing the source code of your own applications.
*
* @see LICENSE.md in the project root for further licensing information.
*/
import yargs from 'yargs'
import { hideBin } from 'yargs/helpers'
import { serveBuilder, serveCommand } from './cli/index.js'
const cli = yargs(hideBin(process.argv), process.cwd())
// --
.scriptName('keywork')
.config('keywork')
.strict()
.wrap(72)
cli
// --
.command('serve <publicDir>', 'Serves a Keywork Router', serveCommand, serveBuilder)
.alias('s', 'serve')
cli.help()
await cli
.check((argv) => {
if (argv._.length === 0) {
throw new Error('No command specified')
}
return true
})
.parse()