Add reporting and debug settings with context-aware CLI selection

This commit is contained in:
2026-09-24 17:27:11 +00:00
parent b98604e5ca
commit 63fcfc487d
8 changed files with 168 additions and 72 deletions

View File

@@ -1,11 +1,20 @@
package main
import (
"context"
"os"
"os/signal"
"syscall"
"gitea.maximumdirect.net/eric/audita/internal/cli"
)
func main() {
os.Exit(cli.Run(os.Args[1:], os.Stdout, os.Stderr))
os.Exit(run())
}
func run() int {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return cli.Run(ctx, os.Args[1:], os.Stdout, os.Stderr)
}

View File

@@ -2,6 +2,7 @@ package main
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
@@ -23,7 +24,7 @@ func TestProcessSubprocessHelper(t *testing.T) {
}
for i, arg := range os.Args {
if arg == "--" {
os.Exit(cli.Run(os.Args[i+1:], os.Stdout, os.Stderr))
os.Exit(cli.Run(context.Background(), os.Args[i+1:], os.Stdout, os.Stderr))
}
}
os.Exit(2)