-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsherry.ts
More file actions
45 lines (34 loc) · 1.23 KB
/
sherry.ts
File metadata and controls
45 lines (34 loc) · 1.23 KB
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
42
43
44
45
#!/usr/bin/env node
import 'source-map-support/register'
import * as cli from 'commander'
import { parseOptsAndStart, parseOptsAndUpload, listFiles, printStatus, stop } from './lib/commands'
const pkg = require('../package.json')
cli.version(pkg.version)
cli.description('Sherry is a cli tool useful for sharing files over a private network.')
cli.command('start')
.description('Start the server used for sharing the files')
.option('-p, --port [port]', 'The port to use for the app')
.action(parseOptsAndStart)
cli.command('upload [files...]')
.description("Upload a file to the server - starts the server if it's not already started")
.option('-p, --port [port]', 'The port to use for the app')
.alias('up')
.action(parseOptsAndUpload)
cli.command('stop')
.description('Stop the server')
.action(async () => {
await stop()
})
cli.command('list').description('List the files that are served by the server')
.alias('ls')
.action(listFiles)
// TODO: Implement this later
// cli.command('status').description('Print the status of the file server')
// .action(printStatus)
cli.command('*').action(() => {
cli.help()
})
cli.parse(process.argv)
if (cli.args.length < 1) {
cli.help()
}