exclude initial commit

This commit is contained in:
2025-05-29 00:30:08 +01:00
commit f249cc2a4d
11 changed files with 317 additions and 0 deletions

21
cmd/context.go Normal file
View File

@@ -0,0 +1,21 @@
package cmd
import (
"context"
"os"
)
type contextKey string
const fileContextKey contextKey = "excludeFile"
// ContextWithFile returns a new context with the given file set.
func ContextWithFile(ctx context.Context, file *os.File) context.Context {
return context.WithValue(ctx, fileContextKey, file)
}
// FileFromContext retrieves the file from the context, if it exists.
func FileFromContext(ctx context.Context) (*os.File, bool) {
file, ok := ctx.Value(fileContextKey).(*os.File)
return file, ok
}