Skip to content

Commit

Permalink
care empty list
Browse files Browse the repository at this point in the history
  • Loading branch information
omochi committed Apr 12, 2019
1 parent a58eb11 commit 05e921d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/toybox/Commands/List.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ struct ListOptions: OptionsProtocol {
}

private func prettyList(_ playgrounds: [Playground]) -> String {
if playgrounds.isEmpty {
return ""
}

let maxNameCount = playgrounds.max { $0.name.count < $1.name.count }!.name.count
let maxPlatformCount = playgrounds.max { $0.platform.rawValue.count < $1.platform.rawValue.count }!.platform.displayName.count
let maxContentLengthCount = String(playgrounds.max { $0.contentLength ?? 0 < $1.contentLength ?? 0 }!.contentLength ?? 0).count
Expand Down

0 comments on commit 05e921d

Please sign in to comment.