Skip to content

Commit

Permalink
Fix ls output for format change
Browse files Browse the repository at this point in the history
Ensures `ls -l` still works when listing files and multiple directories.
Fixes issues introduced in puppetlabs-toy-chest#776.

Signed-off-by: Michael Smith <[email protected]>
  • Loading branch information
MikaelSmith committed Jun 17, 2020
1 parent aba5a09 commit 04322da
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,11 @@ func formatItem(item lsItem, longFormat bool) [][]string {
return rows
}

// Pads a row to ensure the same number of columns.
// Note that the name is put at the beginning so directories are listed on the left.
func pad(str string, longFormat bool) []string {
if longFormat {
return []string{str, "", ""}
return []string{str, "", "", ""}
}
return []string{str}
}
Expand Down

0 comments on commit 04322da

Please sign in to comment.