mfer/internal/cli/manifest.go

52 lines
936 B
Go
Raw Normal View History

2022-12-02 00:31:49 +00:00
package cli
import (
"git.eeqj.de/sneak/mfer/mfer"
"github.com/spf13/afero"
)
type Job struct {
innerpb *mfer.MFFileInner
outerpb *mfer.MFFile
fileCount int64
totalSize int64
afs afero.Fs
}
func (m *Job) scanForFiles() error {
m.innerpb = &mfer.MFFileInner{}
m.innerpb.Version = mfer.MFFileInner_ONE
return nil
}
/*
walkErr := filepath.Walk(m.sourcePath, func(itemPath string, info os.FileInfo, err error) error {
// we do not include the manifest file in the manifest
if itemPath == "index.mf" {
return nil
}
fpi := mfer.MFFilePath{}
fpi.Path = itemPath
fpi.Size = info.Size()
m.innerpb.Files = append(m.innerpb.Files, &fpi)
m.fileCount++
m.totalSize += fpi.Size
return nil
})
if walkErr != nil {
log.Fatal(walkErr)
return walkErr
}
fmt.Printf("%#v\n", m.innerpb)
fmt.Printf("filecount = %#v\n", m.fileCount)
fmt.Printf("totalsize = %#v\n", m.totalSize)
return nil
}
*/