-
Notifications
You must be signed in to change notification settings - Fork 5
/
cli.js
executable file
·72 lines (66 loc) · 1.5 KB
/
cli.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/env node
var subcommand = require('subcommand')
process.title = 'dat'
var commands = [
{
name: 'clone',
command: require('./commands/clone')
},
{
name: 'create',
command: require('./commands/create'),
options: [
{
name: 'import',
boolean: true,
default: true
}
]
},
{
name: 'pull',
command: require('./commands/pull')
},
{
name: 'start',
command: require('./commands/sync'),
options: [
{
name: 'import',
boolean: true,
default: true
}
]
},
{
name: 'sync',
command: require('./commands/sync'),
options: [
{
name: 'import',
boolean: true,
default: true
}
]
}
]
var config = {
defaults: [
{ name: 'dir', default: process.cwd() },
{ name: 'logspeed', default: 200 }
],
none: none,
commands: commands
}
var match = subcommand(config)
match(process.argv.slice(2))
function none () {
console.error('Usage: dat-verb <cmd> [options]')
console.error(' dat create create a local dat')
console.error(' dat sync sync updated files for a local dat or update a remote dat')
console.error(' dat clone <dat-link> <directory> clone a remote dat')
console.error(' dat pull download updated files from a remote dat and exit')
console.error('')
console.error(' --dir=<folder> set directory for all commands')
process.exit(1)
}