mirror of
https://github.com/onyx-and-iris/exclude.git
synced 2026-04-16 14:13:39 +00:00
simplify del/reset commands by using readWriteTruncater interface.
remove the type assertions update the tests: the tests now check output as well as file contents separately.
This commit is contained in:
@@ -7,6 +7,13 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// readWriteTruncater is the interface satisfied by *os.File that allows
|
||||
// reading, writing, seeking, and truncating — the operations needed to rewrite the exclude file.
|
||||
type readWriteTruncater interface {
|
||||
io.ReadWriteSeeker
|
||||
Truncate(size int64) error
|
||||
}
|
||||
|
||||
// readExistingPatterns reads the existing patterns from the exclude file, ignoring comments and empty lines
|
||||
func readExistingPatterns(f io.Reader) ([]string, error) {
|
||||
var patterns []string
|
||||
|
||||
Reference in New Issue
Block a user