From 0ac0a7b5716fcd1d9e5abd936674d27c1037742a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:10:07 +0000 Subject: [PATCH 1/2] Update module go.followtheprocess.codes/cli to v0.17.0 --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 2fd43cc..6d3349a 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25 require ( github.com/rogpeppe/go-internal v1.14.1 - go.followtheprocess.codes/cli v0.16.0 + go.followtheprocess.codes/cli v0.17.0 go.followtheprocess.codes/hue v1.0.0 go.followtheprocess.codes/log v1.2.0 go.followtheprocess.codes/msg v1.9.2 @@ -13,7 +13,7 @@ require ( ) require ( - golang.org/x/sys v0.37.0 // indirect + golang.org/x/sys v0.38.0 // indirect golang.org/x/term v0.36.0 // indirect golang.org/x/tools v0.38.0 // indirect ) diff --git a/go.sum b/go.sum index 7658b98..afac864 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -go.followtheprocess.codes/cli v0.16.0 h1:fzuJQifIdZA8gPAOKMklJ2jdp5UaGbBXH8txzoUAN6E= -go.followtheprocess.codes/cli v0.16.0/go.mod h1:3zCwrPo0bbuFbLVVOdkLgcMLL6oEmErx0vYu8RfKfao= +go.followtheprocess.codes/cli v0.17.0 h1:wAahiHmRUGEZ72jXOrZw5mPzU5h5qYDzqEt39zaW684= +go.followtheprocess.codes/cli v0.17.0/go.mod h1:vNqup3nFyWFAqJdZyL8s29ES/dt2FOJsvJ7kFH+CgWc= go.followtheprocess.codes/hue v1.0.0 h1:0fYXAGR1o+w7Vja+Q+iVtqeEP3/CE6ET/pniyl8e9yo= go.followtheprocess.codes/hue v1.0.0/go.mod h1:gSn5xK6KJapih+eFgQk3woo1qg3/rx9XSrAanUIuDr8= go.followtheprocess.codes/log v1.2.0 h1:23MY3BRVe9fr+mFCofVixv//RcmaMVCk56MZY/aRWW8= @@ -14,8 +14,8 @@ go.followtheprocess.codes/spin v0.3.1 h1:1CI1cz2I51ih1BZ98LPZKr/BujzjBg9ec954+x6 go.followtheprocess.codes/spin v0.3.1/go.mod h1:fBVKIvKiOY0UegufW0ALoHMmq0Ffi76ACxWP88WXhWY= go.followtheprocess.codes/test v1.0.0 h1:5m2MPOQpohDC9pf5hgqpH+4ldJP5g+YFVdoGQY41aeU= go.followtheprocess.codes/test v1.0.0/go.mod h1:e627pR8IhsTV/RfuP/WKYjyL0BmuIbmaw2iKlQBCWrY= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= golang.org/x/tools v0.38.0 h1:Hx2Xv8hISq8Lm16jvBZ2VQf+RLmbd7wVUsALibYI/IQ= From 10c70689d39e3fef08285dc5e721dac96612e06e Mon Sep 17 00:00:00 2001 From: Tom Fleet Date: Mon, 10 Nov 2025 06:45:38 +0000 Subject: [PATCH 2/2] Update cli to 0.17.0 --- .goreleaser.yaml | 3 ++- internal/cmd/cmd.go | 9 +++++---- internal/dead/dead.go | 15 ++++++++------- internal/dead/dead_test.go | 3 ++- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 30f79f9..e374b1a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -33,7 +33,8 @@ builds: homebrew_casks: - name: dead - binary: dead + binaries: + - dead directory: Casks description: A dead simple link checker, supporting multiple formats homepage: https://github.com/FollowTheProcess/dead diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 3e9127d..a449564 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -5,6 +5,7 @@ import ( "runtime" "go.followtheprocess.codes/cli" + "go.followtheprocess.codes/cli/flag" "go.followtheprocess.codes/dead/internal/dead" ) @@ -32,8 +33,8 @@ func check() (*cli.Command, error) { return cli.New( "check", cli.Short("Check a file or files in a directory (recursively) for dead links"), - cli.RequiredArg("path", "Path to the file or directory to scan"), - cli.Flag(&options.Debug, "debug", cli.NoShortHand, false, "Enable debug logging"), + cli.Arg(&options.Path, "path", "Path to the file or directory to scan"), + cli.Flag(&options.Debug, "debug", flag.NoShortHand, false, "Enable debug logging"), cli.Flag(&options.Timeout, "timeout", 't', dead.DefaultOverallTimeout, "Timeout for the entire operation"), cli.Flag( &options.RequestTimeout, @@ -49,9 +50,9 @@ func check() (*cli.Command, error) { runtime.NumCPU(), "Number of goroutines available for checking", ), - cli.Run(func(cmd *cli.Command, args []string) error { + cli.Run(func(cmd *cli.Command) error { dead := dead.New(cmd.Stdout(), cmd.Stderr(), options.Debug, version) - return dead.Check(cmd.Arg("path"), options) + return dead.Check(options) }), ) } diff --git a/internal/dead/dead.go b/internal/dead/dead.go index e0b85ed..8e5c72d 100644 --- a/internal/dead/dead.go +++ b/internal/dead/dead.go @@ -75,6 +75,7 @@ func New(stdout, stderr io.Writer, debug bool, version string) Dead { // CheckOptions are the flags passed to the check subcommand. type CheckOptions struct { + Path string // Path to check Debug bool // Enable verbose logging RequestTimeout time.Duration // Per request timeout Timeout time.Duration // Timeout for the whole operation @@ -91,7 +92,7 @@ type CheckResult struct { } // Check is the entry point for the `dead check` subcommand. -func (d Dead) Check(path string, options CheckOptions) error { +func (d Dead) Check(options CheckOptions) error { if options.Parallelism < 1 { options.Parallelism = runtime.NumCPU() } @@ -110,12 +111,12 @@ func (d Dead) Check(path string, options CheckOptions) error { // Range over the results channel which should return the URL, status code and the message // if it's not ok. But not stop the loop, we need to keep processing all links - logger := d.logger.With(slog.String("path", path)) + logger := d.logger.With(slog.String("path", options.Path)) logger.Debug("Checking links") - info, err := os.Stat(path) + info, err := os.Stat(options.Path) if err != nil { - return fmt.Errorf("os.Stat(%s): %w", path, err) + return fmt.Errorf("os.Stat(%s): %w", options.Path, err) } if info.Mode().IsDir() { @@ -123,11 +124,11 @@ func (d Dead) Check(path string, options CheckOptions) error { } if !info.Mode().IsRegular() { - return fmt.Errorf("%s has unsupported file mode: %s", path, info.Mode()) + return fmt.Errorf("%s has unsupported file mode: %s", options.Path, info.Mode()) } // Now we know it's a regular file - f, err := os.Open(path) + f, err := os.Open(options.Path) if err != nil { return err } @@ -139,7 +140,7 @@ func (d Dead) Check(path string, options CheckOptions) error { links := extractLinks(ctx, f) - spinner := spin.New(d.stdout, "Checking "+path) + spinner := spin.New(d.stdout, "Checking "+options.Path) spinner.Start() workers := make([]<-chan CheckResult, 0, options.Parallelism) diff --git a/internal/dead/dead_test.go b/internal/dead/dead_test.go index 07aa3a6..3b9fca1 100644 --- a/internal/dead/dead_test.go +++ b/internal/dead/dead_test.go @@ -20,11 +20,12 @@ func TestMain(m *testing.M) { "check": func() { app := dead.New(os.Stdout, os.Stderr, false, "test") options := dead.CheckOptions{ + Path: os.Args[1], Debug: false, RequestTimeout: dead.DefaultRequestTimeout, Timeout: dead.DefaultOverallTimeout, } - if err := app.Check(os.Args[1], options); err != nil { + if err := app.Check(options); err != nil { fmt.Fprintf(os.Stderr, "Error: %v\n", err) os.Exit(1) //nolint:revive // redundant-test-main-exit, this is a testscript main }