Skip to content

Commit 9ca70ec

Browse files
yim-leeneonichu
andauthored
[5.5][Collections] Update CLI output for 'describe' (#3510)
* Fix CLI output for stars (#3439) What we are displaying here are stars, not watchers, so the output should reflect that. * [Collections] Include more package metadata in CLI output Motivation: The collection API implementation fetches additional package metadata via GitHub APIs but we aren't showing all of it in the CLI. Modifications: Add license and languages. Reorder line items. e.g., the updated output of `describe https://github.com/apple/swift-nio`: ``` Description: Event-driven network application framework for high performance protocol servers & clients, non-blocking. Available Versions: 2.29.0, 2.28.0, 2.27.0, 1.14.2, 1.14.1, 1.14.0 Readme: https://raw.githubusercontent.com/apple/swift-nio/main/README.md License: Apache-2.0 (https://raw.githubusercontent.com/apple/swift-nio/main/LICENSE.txt) Authors: weissi, normanmaurer, Lukasa, compnerd, glbrntt, PeterAdams-A, tomerd, tigerpixel, kevinclark, fabianfett, BasThomas, Davidde94, gwynne, helje5, ktoso, ddunbar, ianpartridge, hassila, tanner0101, 2bjake, Mordil, shekhar-rajak, adamnemecek, AndriusA, toffaletti, agnosticdev, slashmo, adtrevor, Bouke, cpriebe Stars: 6450 Languages: Ruby, Swift, DTrace, C, Dockerfile, Shell, Python ------------------------------------------------------------ Latest Version: 2.29.0 Tools Version: 5.0.0 Package Name: swift-nio Modules: _NIO1APIShims, NIO, _NIOConcurrency, NIOFoundationCompat, NIOConcurrencyHelpers, NIOHTTP1, NIOTLS, NIOWebSocket, NIOTestUtils Products: NIO, _NIO1APIShims, _NIOConcurrency, NIOTLS, NIOHTTP1, NIOConcurrencyHelpers, NIOFoundationCompat, NIOWebSocket, NIOTestUtils ``` rdar://77533967 Co-authored-by: Boris Bügling <[email protected]>
1 parent 50e9c67 commit 9ca70ec

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Documentation/PackageCollections.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Packages:
156156
$ swift package-collection describe [--json] https://github.com/jpsim/yams
157157
Description: A sweet and swifty YAML parser built on LibYAML.
158158
Available Versions: 4.0.0, 3.0.0, ...
159-
Watchers: 14
159+
Stars: 14
160160
Readme: https://github.com/jpsim/Yams/blob/master/README.md
161161
Authors: @norio-nomura, @jpsim
162162
--------------------------------------------------------------

Sources/Commands/SwiftPackageCollectionsTool.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,17 +283,19 @@ public struct SwiftPackageCollectionsTool: ParsableCommand {
283283
} else {
284284
let description = optionalRow("Description", result.package.summary)
285285
let versions = result.package.versions.map { "\($0.version)" }.joined(separator: ", ")
286-
let watchers = optionalRow("Watchers", result.package.watchersCount?.description)
286+
let stars = optionalRow("Stars", result.package.watchersCount?.description)
287287
let readme = optionalRow("Readme", result.package.readmeURL?.absoluteString)
288288
let authors = optionalRow("Authors", result.package.authors?.map { $0.username }.joined(separator: ", "))
289+
let license = optionalRow("License", result.package.license.map { "\($0.type) (\($0.url))" })
290+
let languages = optionalRow("Languages", result.package.languages?.joined(separator: ", "))
289291
let latestVersion = optionalRow("\(String(repeating: "-", count: 60))\n\(indent())Latest Version", printVersion(result.package.latestVersion))
290292

291293
if jsonOptions.json {
292294
try JSONEncoder.makeWithDefaults().print(result.package)
293295
} else {
294296
print("""
295297
\(description)
296-
Available Versions: \(versions)\(watchers)\(readme)\(authors)\(latestVersion)
298+
Available Versions: \(versions)\(readme)\(license)\(authors)\(stars)\(languages)\(latestVersion)
297299
""")
298300
}
299301
}

0 commit comments

Comments
 (0)