diff --git a/Sources/Commands/PackageCommands/EditCommands.swift b/Sources/Commands/PackageCommands/EditCommands.swift index 6e3bbdc4a0c..3575ea7862a 100644 --- a/Sources/Commands/PackageCommands/EditCommands.swift +++ b/Sources/Commands/PackageCommands/EditCommands.swift @@ -35,9 +35,13 @@ extension SwiftPackageCommand { @Argument(help: "The identity of the package to edit") var packageIdentity: String + @OptionGroup(visibility: .hidden) + package var traits: TraitOptions + func run(_ swiftCommandState: SwiftCommandState) async throws { - try await swiftCommandState.resolve(nil) - let workspace = try swiftCommandState.getActiveWorkspace() + // TODO: how does adding traits change how edit behaves here? + try await swiftCommandState.resolve(.init(traitOptions: traits)) + let workspace = try swiftCommandState.getActiveWorkspace(traitConfiguration: .init(traitOptions: traits)) // Put the dependency in edit mode. await workspace.edit( @@ -64,14 +68,17 @@ extension SwiftPackageCommand { @Argument(help: "The identity of the package to unedit") var packageIdentity: String + @OptionGroup(visibility: .hidden) + package var traits: TraitOptions + func run(_ swiftCommandState: SwiftCommandState) async throws { - try await swiftCommandState.resolve(nil) - let workspace = try swiftCommandState.getActiveWorkspace() + try await swiftCommandState.resolve(.init(traitOptions: traits)) + let workspace = try swiftCommandState.getActiveWorkspace(traitConfiguration: .init(traitOptions: traits)) try await workspace.unedit( packageIdentity: packageIdentity, forceRemove: shouldForceRemove, - root: swiftCommandState.getWorkspaceRoot(), + root: swiftCommandState.getWorkspaceRoot(traitConfiguration: .init(traitOptions: traits)), observabilityScope: swiftCommandState.observabilityScope ) }