-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
executable file
·45 lines (26 loc) · 886 Bytes
/
index.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
#!/usr/bin/env node
const { erase } = require('./erase')
var argv = require('yargs/yargs')(process.argv.slice(2))
.usage('Usage: $0 ipAddress [options]')
.example('$0 192.168.1.11 -u user -p secret', 'Removes all recording groups with given credentials')
.demandCommand(1)
.alias('u', 'user')
.nargs('u', 1)
.describe('u', 'The username to be used to authenticate, defaults to "root"')
.alias('p', 'pass')
.nargs('p', 1)
.describe('p', 'The password to be used to authenticate, defaults to "pass"')
.help('h')
.alias('h', 'help')
.epilog('Purge - The Practical and Useful Recording Group Eraser')
.argv;
(async () => {
let address = argv._[0]
let username = argv.user ?? "root"
let password = argv.pass ?? "pass"
try {
await erase(address, username, password)
} catch (e) {
console.error(`Unexpected error: ${e}`)
}
})()