diff --git a/interface.go b/extension.go similarity index 59% rename from interface.go rename to extension.go index bd8de15..91e184c 100644 --- a/interface.go +++ b/extension.go @@ -1,10 +1,5 @@ package goldsmith -import ( - "io" - "time" -) - // Plugin contains the minimum set of methods required on plugins. Plugins can // also optionally implement Initializer, Processor, and Finalizer interfaces. type Plugin interface { @@ -33,33 +28,3 @@ type Filter interface { Name() string Accept(file File) bool } - -type ( - FileProp any - FileProps map[string]FileProp -) - -// File represents in-memory or on-disk files in a chain. -type File interface { - Path() string - Dir() string - Name() string - Ext() string - Rename(path string) error - - Size() int64 - ModTime() time.Time - - Read(data []byte) (int, error) - WriteTo(writer io.Writer) (int64, error) - Seek(offset int64, whence int) (int64, error) - - SetProp(name string, value FileProp) - Prop(name string) (FileProp, bool) - PropOrDef(name string, valueDef FileProp) FileProp - Props() FileProps - CopyProps(file File) - RemoveProp(name string) - - GoString() string -} diff --git a/file.go b/file.go new file mode 100644 index 0000000..badb6aa --- /dev/null +++ b/file.go @@ -0,0 +1,36 @@ +package goldsmith + +import ( + "io" + "time" +) + +type ( + FileProp any + FileProps map[string]FileProp +) + +// File represents in-memory or on-disk files in a chain. +type File interface { + Path() string + Dir() string + Name() string + Ext() string + Rename(path string) error + + Size() int64 + ModTime() time.Time + + Read(data []byte) (int, error) + WriteTo(writer io.Writer) (int64, error) + Seek(offset int64, whence int) (int64, error) + + SetProp(name string, value FileProp) + Prop(name string) (FileProp, bool) + PropOrDef(name string, valueDef FileProp) FileProp + Props() FileProps + CopyProps(file File) + RemoveProp(name string) + + GoString() string +}