-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·33 lines (29 loc) · 969 Bytes
/
index.js
File metadata and controls
executable file
·33 lines (29 loc) · 969 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
33
#!/usr/bin/env node
const { backup, restore, update, rotate, diff, status, verify, template, showHelp } = require('./src/cli');
const { startWeb } = require('./src/web/server');
async function main() {
const command = process.argv[2];
const arg = process.argv[3];
switch (command) {
case 'backup': await backup(); break;
case 'restore': await restore(); break;
case 'update': await update(); break;
case 'diff': await diff(); break;
case 'rotate': await rotate(); break;
case 'status': status(); break;
case 'verify': await verify(); break;
case 'template': template(); break;
case 'web': startWeb(parseInt(arg) || 3000); break;
case 'help':
case '--help':
case '-h': showHelp(); break;
default:
if (command) console.error(`Unknown command: ${command}`);
showHelp();
process.exit(command ? 1 : 0);
}
}
main().catch(err => {
console.error('Error:', err.message);
process.exit(1);
});