58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"git.gay/besties/ios-safari-remote-debug/build"
|
|
"git.gay/besties/ios-safari-remote-debug/server"
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
func main() {
|
|
app := &cli.App{
|
|
Commands: []*cli.Command{
|
|
{
|
|
Name: "build",
|
|
Usage: "build the iOS Safari remote debugging tool",
|
|
Flags: []cli.Flag{
|
|
&cli.PathFlag{
|
|
Name: "output",
|
|
Aliases: []string{"o"},
|
|
Value: "dist",
|
|
Usage: "output built iOS Safari debugger to `DIR`",
|
|
},
|
|
},
|
|
Action: func(ctx *cli.Context) error {
|
|
clonePath, err := build.Clone()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return build.Build(clonePath, ctx.Path("output"))
|
|
},
|
|
},
|
|
{
|
|
Name: "serve",
|
|
Usage: "serve the iOS Safari remote debugging tool once it's built",
|
|
Flags: []cli.Flag{
|
|
&cli.PathFlag{
|
|
Name: "input",
|
|
Value: "dist",
|
|
Aliases: []string{"i"},
|
|
Usage: "serve built iOS Safari debugger from `DIR`",
|
|
},
|
|
&cli.StringFlag{
|
|
Name: "address",
|
|
Usage: "the address to listen on",
|
|
Value: ":8924",
|
|
},
|
|
},
|
|
Action: server.ListenCommand,
|
|
},
|
|
},
|
|
}
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
log.Fatal().Err(err).Send()
|
|
}
|
|
} |