github.com/Cloud-Foundations/Dominator@v0.3.4/cmd/imagetool/estimate.go (about) 1 package main 2 3 import ( 4 "fmt" 5 6 "github.com/Cloud-Foundations/Dominator/lib/format" 7 "github.com/Cloud-Foundations/Dominator/lib/log" 8 ) 9 10 func estimateImageUsageSubcommand(args []string, logger log.DebugLogger) error { 11 if err := estimateImageUsage(args[0]); err != nil { 12 return fmt.Errorf("error estimating image size: %s", err) 13 } 14 return nil 15 } 16 17 func estimateImageUsage(image string) error { 18 fs, err := getTypedFileSystem(image) 19 if err != nil { 20 return err 21 } 22 _, err = fmt.Println(format.FormatBytes(fs.EstimateUsage(0))) 23 return err 24 }