Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Sources/parrot/Parrot.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,13 @@ struct Models: ParsableCommand {

struct List: ParsableCommand {
func run() throws {
// Column width follows the longest id: `padding(toLength:)` truncates
// when the string is longer, and a truncated id cannot be copied into
// `parrot models download`.
let width = ModelRegistry.shared.map(\.id.count).max() ?? 26
for m in ModelRegistry.shared {
let star = m.recommended ? "★" : " "
let id = m.id.padding(toLength: 26, withPad: " ", startingAt: 0)
let id = m.id.padding(toLength: width, withPad: " ", startingAt: 0)
let langs = "[\(m.languages.joined(separator: ","))]"
.padding(toLength: 9, withPad: " ", startingAt: 0)
let size = String(format: "%5d MB", m.sizeMB)
Expand Down