/
index.js
executable file
·42 lines (40 loc) · 1.42 KB
/
index.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
#!/usr/bin/env node
import { init } from "./init.js"
import { sign } from "./sign.js"
import { view } from "./view.js"
import graphics from './utils/graphics.js'
// Check for command-line arguments
const args = process.argv.slice(2)
if (args[0] === "init") {
init()
} else if (args[0] === "sign") {
sign()
} else if (args[0] === "view") {
view()
} else {
// WELCOME!
graphics.print(graphics.asciiArt, 'orange')
graphics.logo()
console.log()
graphics.print(" ○ @namesys-eth/dev3-eth: v0.0.6-beta", "skyblue")
graphics.print(" ▲ Please run 'npx dev3-eth init' (global install) or 'npm run init' (local install) to initialise", "skyblue")
graphics.print(" ▲ Please run 'npx dev3-eth sign' (global install) or 'npm run sign' (local install) to sign & publish your ENS records", "skyblue")
graphics.print(" ▲ Please run 'npx dev3-eth view' (global install) or 'npm run view' (local install) to view your ENS records", "skyblue")
graphics.print(" ◥ docs: https://dev3.eth.limo", "yellow")
}
// Determine which function to run based on the command-line argument
if (args.length > 1) {
switch (args[1]) {
case 'init':
init()
break
case 'sign':
sign()
break
case 'view':
view()
break
default:
console.log('Invalid function name (available functions: init, sign, view)')
}
}