-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.ts
144 lines (129 loc) · 3.39 KB
/
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
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
import {
checkVersion,
Command,
deploy,
init,
keygen,
keyls,
keyrm,
list,
login,
logout,
remove,
signup,
start,
upgrade,
util,
} from './cli/mod.ts'
import 'https://deno.land/[email protected]/dotenv/load.ts'
export const version = 'v0.4.22'
const command = new Command()
.name('arkiver')
.version(version)
.description('The CLI tool for RoboArkiver')
// login
command
.command('login', 'Login to RoboArkiver')
.option('-e, --email <email:string>', 'Email address')
.option('-p, --password <password:string>', 'Password')
.action(async (opts, ...args) => {
await checkVersion(version)
await login.action(opts, ...args)
})
// signup
command
.command('signup', 'Signup to RoboArkiver')
.option('-e, --email <email:string>', 'Email address')
.option('-p, --password <password:string>', 'Password')
.option('-u, --username <username:string>', 'Username')
.action(async (opts, ...args) => {
await checkVersion(version)
await signup.action(opts, ...args)
})
// signout
command.command('logout', 'Logout from RoboArkiver').action(logout.action)
// deploy
command
.command('deploy', 'Deploy arkive')
.option('--private', 'Make arkive private')
.option('--major', 'Deploy as major version')
.option('--env <env:string>', 'Environment to deploy to')
.arguments('<dir:string>')
.action(async (opts, ...args) => {
await checkVersion(version)
await deploy.action(opts, ...args)
})
// delete
command
.command('delete', 'Delete arkive')
.arguments('<dir:string>')
.option('-m, --manifest <manifest:string>', 'Path to manifest file', {
default: './manifest.ts',
})
.action(async (opts, dir) => {
await checkVersion(version)
await remove.action(opts, dir)
})
// start
command
.command('start', 'Start local development arkiver')
.arguments('<dir:string>')
.option('-m, --manifest <manifest:string>', 'Path to manifest file', {
default: './manifest.ts',
})
.option(
'-c, --mongo-connection <mongoConnection:string>',
'MongoDB Connection String',
)
.option('-r, --rpc-url <rpcUrl:string>', 'RPC URL', {
collect: true,
})
.option('--no-gql', 'Disable GraphQL server')
.option('--no-db', 'Don\'t connect to MongoDB')
.option('--log-level <logLevel:string>', 'Log level', {
default: 'INFO',
})
.option('--gql-only', 'Only start GraphQL server')
.action(async (opts, ...args) => {
util.logHeader(version)
await checkVersion(version)
await start.action(opts, ...args)
})
// init
command
.command('init', 'Initialize a new arkive project')
.action(async () => {
util.logHeader(version)
await checkVersion(version)
await init.action()
})
// upgrade
command
.command('upgrade', 'Upgrade arkiver to latest version')
.action(async () => await upgrade.action(version))
// list
command
.command('list', 'List all your arkives')
.option('-A, --all', 'List all arkives')
.option('-s, --status <status>', 'Filter by status')
.action(async (opts) => {
await checkVersion(version)
await list.action(opts)
})
// keygen
command
.command('keygen', 'Generate a new API key')
.action(keygen.action)
// keyrm
command
.command('keyrm', 'Delete an API key')
.arguments('<key:string>')
.action(async (_, key) => {
await keyrm.action(key)
})
command
.command('keyls', 'List all API keys')
.action(keyls.action)
if (import.meta.main) {
await command.parse(Deno.args)
}