forked from mostafa/goja_debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
46 lines (42 loc) · 915 Bytes
/
main.go
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
package main
import (
"log"
"os"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "goja_debugger",
Usage: "Runs or inspects a JS script with Goja",
Commands: []*cli.Command{
{
Name: "run",
Aliases: []string{"r"},
Usage: "Runs a JS script with Goja",
Action: func(c *cli.Context) error {
return debug(false, "", c.Args().First())
},
},
{
Name: "inspect",
Aliases: []string{"i"},
Usage: "Debugs a JS script with Goja",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "liveinfo",
Aliases: []string{"l"},
Value: "pc",
Usage: "Show program counter (pc) or line number (line) in debug prompt",
},
},
Action: func(c *cli.Context) error {
return debug(true, c.String("liveinfo"), c.Args().First())
},
},
},
}
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}