-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
32 lines (26 loc) · 791 Bytes
/
main.ts
File metadata and controls
32 lines (26 loc) · 791 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
import * as app from 'commander'
import { serve } from './src/server'
import { joinGame } from './src/client/client';
app.version('0.0.1')
app
.command('server')
.description('Start a poll')
.option('-t --title <title>', 'Give it a title')
.option('-a --address <address>', 'Server address')
.option('-d --debug', 'Print app state to screen')
.action((cmd) => {
serve(cmd.address, cmd.title, cmd.debug)
})
app
.command('client')
.description('Play Planning Poker')
.option('-g --game <id>', 'Game <uuid>')
.option('-a --address <address>', 'Server address')
.option('-n --name <name>', 'Player name')
.action((cmd) =>
joinGame(cmd.game, cmd.address, cmd.name))
if(!process.argv.slice(3).length) {
app.outputHelp()
process.exit()
}
app.parse(process.argv)