-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (31 loc) · 662 Bytes
/
main.go
File metadata and controls
35 lines (31 loc) · 662 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
34
35
package main
import (
"context"
"log"
"os"
"github.com/narasaka/weasel/helpers"
"github.com/urfave/cli/v3"
)
func main() {
cmd := &cli.Command{
Name: "weasel",
Usage: "check for broken links",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "recursive",
Aliases: []string{"r"},
Usage: "recursively check links within the same domain",
},
},
Action: func(ctx context.Context, c *cli.Command) error {
if c.Args().Len() == 0 {
return cli.ShowAppHelp(c)
}
helpers.Check(c.Args().First(), c.Bool("recursive"))
return nil
},
}
if err := cmd.Run(context.Background(), os.Args); err != nil {
log.Fatal(err)
}
}