Skip to content

Commit

Permalink
Replace [FilePath] with single String?
Browse files Browse the repository at this point in the history
  • Loading branch information
rock88 committed May 13, 2024
1 parent 5869eca commit e628511
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Sources/Frontend/Commands/ScanCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ struct ScanCommand: FrontendCommand {
@Flag(help: "Only output results")
var quiet: Bool = defaultConfiguration.$quiet.defaultValue

@Option(parsing: .upToNextOption, help: "JSON package manifest path (obtained using `swift package describe --type json` or manually)")
var jsonPackageManifestPath: [FilePath] = defaultConfiguration.$jsonPackageManifestPath.defaultValue
@Option(help: "JSON package manifest path (obtained using `swift package describe --type json` or manually)")
var jsonPackageManifestPath: String?

private static let defaultConfiguration = Configuration()

Expand Down
6 changes: 3 additions & 3 deletions Sources/PeripheryKit/SPM/SPM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ public struct SPM {
}

public struct Package: Decodable {
public static func load(jsonPackageManifestPath: [FilePath] = []) throws -> Self {
public static func load(jsonPackageManifestPath: String? = nil) throws -> Self {
Logger().contextualized(with: "spm:package").debug("Loading \(FilePath.current)")

let jsonData: Data

if let path = jsonPackageManifestPath.first {
jsonData = try Data(contentsOf: path.url)
if let jsonPackageManifestPath {
jsonData = try Data(contentsOf: URL(fileURLWithPath: jsonPackageManifestPath))
} else {
let jsonString = try Shell.shared.exec(["swift", "package", "describe", "--type", "json"], stderr: false)

Expand Down
4 changes: 2 additions & 2 deletions Sources/Shared/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ public final class Configuration {
@Setting(key: "relative_results", defaultValue: false)
public var relativeResults: Bool

@Setting(key: "json_package_manifest_path", defaultValue: [])
public var jsonPackageManifestPath: [FilePath]
@Setting(key: "json_package_manifest_path", defaultValue: nil)
public var jsonPackageManifestPath: String?

// Non user facing.
public var guidedSetup: Bool = false
Expand Down

0 comments on commit e628511

Please sign in to comment.