Skip to content

Commit 482a5c0

Browse files
feat(cli): add --quiet/-q flag to suppress raw process log
Without --quiet: shows full [core], [cert], [wait], [check] log lines With --quiet: shows only the variant result summary line per example Useful for CI where clean output matters. Also add "io" import (was missing after refactor). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 932b709 commit 482a5c0

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

cmd/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package main
44
import (
55
"context"
66
"fmt"
7+
"io"
78
"io/fs"
89
"os"
910
"os/signal"
@@ -33,6 +34,7 @@ var (
3334
flagDBPath string
3435
flagExamplesDir string
3536
flagTimeout int
37+
flagQuiet bool
3638
)
3739

3840
func rootCmd() *cobra.Command {
@@ -45,6 +47,7 @@ func rootCmd() *cobra.Command {
4547
root.PersistentFlags().StringVar(&flagDBPath, "db", store.DefaultPath(), "SQLite result database path")
4648
root.PersistentFlags().StringVar(&flagExamplesDir, "examples", "examples", "examples root directory")
4749
root.PersistentFlags().IntVar(&flagTimeout, "timeout", 30, "per-check timeout in seconds")
50+
root.PersistentFlags().BoolVarP(&flagQuiet, "quiet", "q", false, "suppress raw process log; show only result summary")
4851

4952
root.AddCommand(
5053
runCmd(),
@@ -75,7 +78,11 @@ func runCmd() *cobra.Command {
7578

7679
func runOne(ctx context.Context, dir string, db *store.DB) error {
7780
fmt.Printf("▶ %s\n", dir)
78-
results, err := runner.Run(ctx, dir, os.Stdout)
81+
logOut := io.Writer(os.Stdout)
82+
if flagQuiet {
83+
logOut = io.Discard
84+
}
85+
results, err := runner.Run(ctx, dir, logOut)
7986
if err != nil {
8087
fmt.Printf(" ERROR: %v\n", err)
8188
return err

hiddify-health

7.21 MB
Binary file not shown.

0 commit comments

Comments
 (0)