Merge pull request #667 from anderbubble/485-fix-overlay-ls-header

Correct header for overlay list -al
This commit is contained in:
Jonathon Anderson
2023-02-18 23:23:13 -07:00
committed by GitHub
2 changed files with 17 additions and 11 deletions

View File

@@ -39,16 +39,7 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
files := util.FindFiles(path)
wwlog.Debug("Iterating overlay path: %s", path)
if ListContents {
var fileCount int
for file := range files {
fmt.Printf("%-30s /%-12s\n", name, files[file])
fileCount++
}
if fileCount == 0 {
fmt.Printf("%-30s %-12d\n", name, 0)
}
} else if ListLong {
if ListLong {
for file := range files {
s, err := os.Stat(files[file])
if err != nil {
@@ -61,7 +52,15 @@ func CobraRunE(cmd *cobra.Command, args []string) error {
sys := s.Sys()
fmt.Printf("%v %5d %-5d %-18s /%s\n", perms, sys.(*syscall.Stat_t).Uid, sys.(*syscall.Stat_t).Gid, overlays[o], files[file])
}
} else if ListContents {
var fileCount int
for file := range files {
fmt.Printf("%-30s /%-12s\n", name, files[file])
fileCount++
}
if fileCount == 0 {
fmt.Printf("%-30s %-12d\n", name, 0)
}
} else {
fmt.Printf("%-30s %-12d\n", name, len(files))