diff --git a/Sources/Swiftly/ListAvailable.swift b/Sources/Swiftly/ListAvailable.swift index 141e0d7b..ee084812 100644 --- a/Sources/Swiftly/ListAvailable.swift +++ b/Sources/Swiftly/ListAvailable.swift @@ -45,7 +45,7 @@ struct ListAvailable: SwiftlyCommand { try ToolchainSelector(parsing: input) } - let config = try Config.load() + var config = try Config.load() let tc: [ToolchainVersion] @@ -67,15 +67,19 @@ struct ListAvailable: SwiftlyCommand { let toolchains = tc.filter { selector?.matches(toolchain: $0) ?? true } let installedToolchains = Set(config.listInstalledToolchains(selector: selector)) - let activeToolchain = config.inUse + let (inUse, _) = try await selectToolchain(config: &config) let printToolchain = { (toolchain: ToolchainVersion) in var message = "\(toolchain)" - if toolchain == activeToolchain { - message += " (installed, in use)" - } else if installedToolchains.contains(toolchain) { + if installedToolchains.contains(toolchain) { message += " (installed)" } + if let inUse, toolchain == inUse { + message += " (in use)" + } + if toolchain == config.inUse { + message += " (default)" + } SwiftlyCore.print(message) }