diff --git a/Package.swift b/Package.swift index ae5b989a..098be1cf 100644 --- a/Package.swift +++ b/Package.swift @@ -71,7 +71,7 @@ let package = Package( "ContainerClient", "ContainerCommands", ], - path: "Sources/ExecutableCLI" + path: "Sources/CLI" ), .target( name: "ContainerCommands", @@ -90,7 +90,7 @@ let package = Package( "ContainerVersion", "TerminalProgress", ], - path: "Sources/CLI" + path: "Sources/ContainerCommands" ), .executableTarget( name: "container-apiserver", diff --git a/Sources/ExecutableCLI/Executable.swift b/Sources/CLI/Executable.swift similarity index 100% rename from Sources/ExecutableCLI/Executable.swift rename to Sources/CLI/Executable.swift diff --git a/Sources/CLI/Application.swift b/Sources/ContainerCommands/Application.swift similarity index 100% rename from Sources/CLI/Application.swift rename to Sources/ContainerCommands/Application.swift diff --git a/Sources/CLI/BuildCommand.swift b/Sources/ContainerCommands/BuildCommand.swift similarity index 100% rename from Sources/CLI/BuildCommand.swift rename to Sources/ContainerCommands/BuildCommand.swift diff --git a/Sources/CLI/Builder/Builder.swift b/Sources/ContainerCommands/Builder/Builder.swift similarity index 100% rename from Sources/CLI/Builder/Builder.swift rename to Sources/ContainerCommands/Builder/Builder.swift diff --git a/Sources/CLI/Builder/BuilderDelete.swift b/Sources/ContainerCommands/Builder/BuilderDelete.swift similarity index 100% rename from Sources/CLI/Builder/BuilderDelete.swift rename to Sources/ContainerCommands/Builder/BuilderDelete.swift diff --git a/Sources/CLI/Builder/BuilderStart.swift b/Sources/ContainerCommands/Builder/BuilderStart.swift similarity index 100% rename from Sources/CLI/Builder/BuilderStart.swift rename to Sources/ContainerCommands/Builder/BuilderStart.swift diff --git a/Sources/CLI/Builder/BuilderStatus.swift b/Sources/ContainerCommands/Builder/BuilderStatus.swift similarity index 100% rename from Sources/CLI/Builder/BuilderStatus.swift rename to Sources/ContainerCommands/Builder/BuilderStatus.swift diff --git a/Sources/CLI/Builder/BuilderStop.swift b/Sources/ContainerCommands/Builder/BuilderStop.swift similarity index 100% rename from Sources/CLI/Builder/BuilderStop.swift rename to Sources/ContainerCommands/Builder/BuilderStop.swift diff --git a/Sources/CLI/Codable+JSON.swift b/Sources/ContainerCommands/Codable+JSON.swift similarity index 100% rename from Sources/CLI/Codable+JSON.swift rename to Sources/ContainerCommands/Codable+JSON.swift diff --git a/Sources/CLI/Container/ContainerCreate.swift b/Sources/ContainerCommands/Container/ContainerCreate.swift similarity index 100% rename from Sources/CLI/Container/ContainerCreate.swift rename to Sources/ContainerCommands/Container/ContainerCreate.swift diff --git a/Sources/CLI/Container/ContainerDelete.swift b/Sources/ContainerCommands/Container/ContainerDelete.swift similarity index 100% rename from Sources/CLI/Container/ContainerDelete.swift rename to Sources/ContainerCommands/Container/ContainerDelete.swift diff --git a/Sources/CLI/Container/ContainerExec.swift b/Sources/ContainerCommands/Container/ContainerExec.swift similarity index 100% rename from Sources/CLI/Container/ContainerExec.swift rename to Sources/ContainerCommands/Container/ContainerExec.swift diff --git a/Sources/CLI/Container/ContainerInspect.swift b/Sources/ContainerCommands/Container/ContainerInspect.swift similarity index 100% rename from Sources/CLI/Container/ContainerInspect.swift rename to Sources/ContainerCommands/Container/ContainerInspect.swift diff --git a/Sources/CLI/Container/ContainerKill.swift b/Sources/ContainerCommands/Container/ContainerKill.swift similarity index 100% rename from Sources/CLI/Container/ContainerKill.swift rename to Sources/ContainerCommands/Container/ContainerKill.swift diff --git a/Sources/CLI/Container/ContainerList.swift b/Sources/ContainerCommands/Container/ContainerList.swift similarity index 100% rename from Sources/CLI/Container/ContainerList.swift rename to Sources/ContainerCommands/Container/ContainerList.swift diff --git a/Sources/CLI/Container/ContainerLogs.swift b/Sources/ContainerCommands/Container/ContainerLogs.swift similarity index 100% rename from Sources/CLI/Container/ContainerLogs.swift rename to Sources/ContainerCommands/Container/ContainerLogs.swift diff --git a/Sources/CLI/Container/ContainerStart.swift b/Sources/ContainerCommands/Container/ContainerStart.swift similarity index 100% rename from Sources/CLI/Container/ContainerStart.swift rename to Sources/ContainerCommands/Container/ContainerStart.swift diff --git a/Sources/CLI/Container/ContainerStop.swift b/Sources/ContainerCommands/Container/ContainerStop.swift similarity index 100% rename from Sources/CLI/Container/ContainerStop.swift rename to Sources/ContainerCommands/Container/ContainerStop.swift diff --git a/Sources/CLI/Container/ContainersCommand.swift b/Sources/ContainerCommands/Container/ContainersCommand.swift similarity index 100% rename from Sources/CLI/Container/ContainersCommand.swift rename to Sources/ContainerCommands/Container/ContainersCommand.swift diff --git a/Sources/CLI/Container/ProcessUtils.swift b/Sources/ContainerCommands/Container/ProcessUtils.swift similarity index 100% rename from Sources/CLI/Container/ProcessUtils.swift rename to Sources/ContainerCommands/Container/ProcessUtils.swift diff --git a/Sources/CLI/DefaultCommand.swift b/Sources/ContainerCommands/DefaultCommand.swift similarity index 100% rename from Sources/CLI/DefaultCommand.swift rename to Sources/ContainerCommands/DefaultCommand.swift diff --git a/Sources/CLI/Image/ImageCommand.swift b/Sources/ContainerCommands/Image/ImageCommand.swift similarity index 100% rename from Sources/CLI/Image/ImageCommand.swift rename to Sources/ContainerCommands/Image/ImageCommand.swift diff --git a/Sources/CLI/Image/ImageInspect.swift b/Sources/ContainerCommands/Image/ImageInspect.swift similarity index 100% rename from Sources/CLI/Image/ImageInspect.swift rename to Sources/ContainerCommands/Image/ImageInspect.swift diff --git a/Sources/CLI/Image/ImageList.swift b/Sources/ContainerCommands/Image/ImageList.swift similarity index 100% rename from Sources/CLI/Image/ImageList.swift rename to Sources/ContainerCommands/Image/ImageList.swift diff --git a/Sources/CLI/Image/ImageLoad.swift b/Sources/ContainerCommands/Image/ImageLoad.swift similarity index 100% rename from Sources/CLI/Image/ImageLoad.swift rename to Sources/ContainerCommands/Image/ImageLoad.swift diff --git a/Sources/CLI/Image/ImagePrune.swift b/Sources/ContainerCommands/Image/ImagePrune.swift similarity index 100% rename from Sources/CLI/Image/ImagePrune.swift rename to Sources/ContainerCommands/Image/ImagePrune.swift diff --git a/Sources/CLI/Image/ImagePull.swift b/Sources/ContainerCommands/Image/ImagePull.swift similarity index 100% rename from Sources/CLI/Image/ImagePull.swift rename to Sources/ContainerCommands/Image/ImagePull.swift diff --git a/Sources/CLI/Image/ImagePush.swift b/Sources/ContainerCommands/Image/ImagePush.swift similarity index 100% rename from Sources/CLI/Image/ImagePush.swift rename to Sources/ContainerCommands/Image/ImagePush.swift diff --git a/Sources/CLI/Image/ImageRemove.swift b/Sources/ContainerCommands/Image/ImageRemove.swift similarity index 100% rename from Sources/CLI/Image/ImageRemove.swift rename to Sources/ContainerCommands/Image/ImageRemove.swift diff --git a/Sources/CLI/Image/ImageSave.swift b/Sources/ContainerCommands/Image/ImageSave.swift similarity index 100% rename from Sources/CLI/Image/ImageSave.swift rename to Sources/ContainerCommands/Image/ImageSave.swift diff --git a/Sources/CLI/Image/ImageTag.swift b/Sources/ContainerCommands/Image/ImageTag.swift similarity index 100% rename from Sources/CLI/Image/ImageTag.swift rename to Sources/ContainerCommands/Image/ImageTag.swift diff --git a/Sources/CLI/Network/NetworkCommand.swift b/Sources/ContainerCommands/Network/NetworkCommand.swift similarity index 100% rename from Sources/CLI/Network/NetworkCommand.swift rename to Sources/ContainerCommands/Network/NetworkCommand.swift diff --git a/Sources/CLI/Network/NetworkCreate.swift b/Sources/ContainerCommands/Network/NetworkCreate.swift similarity index 100% rename from Sources/CLI/Network/NetworkCreate.swift rename to Sources/ContainerCommands/Network/NetworkCreate.swift diff --git a/Sources/CLI/Network/NetworkDelete.swift b/Sources/ContainerCommands/Network/NetworkDelete.swift similarity index 100% rename from Sources/CLI/Network/NetworkDelete.swift rename to Sources/ContainerCommands/Network/NetworkDelete.swift diff --git a/Sources/CLI/Network/NetworkInspect.swift b/Sources/ContainerCommands/Network/NetworkInspect.swift similarity index 100% rename from Sources/CLI/Network/NetworkInspect.swift rename to Sources/ContainerCommands/Network/NetworkInspect.swift diff --git a/Sources/CLI/Network/NetworkList.swift b/Sources/ContainerCommands/Network/NetworkList.swift similarity index 100% rename from Sources/CLI/Network/NetworkList.swift rename to Sources/ContainerCommands/Network/NetworkList.swift diff --git a/Sources/CLI/Registry/Login.swift b/Sources/ContainerCommands/Registry/Login.swift similarity index 100% rename from Sources/CLI/Registry/Login.swift rename to Sources/ContainerCommands/Registry/Login.swift diff --git a/Sources/CLI/Registry/Logout.swift b/Sources/ContainerCommands/Registry/Logout.swift similarity index 100% rename from Sources/CLI/Registry/Logout.swift rename to Sources/ContainerCommands/Registry/Logout.swift diff --git a/Sources/CLI/Registry/RegistryCommand.swift b/Sources/ContainerCommands/Registry/RegistryCommand.swift similarity index 100% rename from Sources/CLI/Registry/RegistryCommand.swift rename to Sources/ContainerCommands/Registry/RegistryCommand.swift diff --git a/Sources/CLI/RunCommand.swift b/Sources/ContainerCommands/RunCommand.swift similarity index 100% rename from Sources/CLI/RunCommand.swift rename to Sources/ContainerCommands/RunCommand.swift diff --git a/Sources/CLI/System/DNS/DNSCreate.swift b/Sources/ContainerCommands/System/DNS/DNSCreate.swift similarity index 100% rename from Sources/CLI/System/DNS/DNSCreate.swift rename to Sources/ContainerCommands/System/DNS/DNSCreate.swift diff --git a/Sources/CLI/System/DNS/DNSDelete.swift b/Sources/ContainerCommands/System/DNS/DNSDelete.swift similarity index 100% rename from Sources/CLI/System/DNS/DNSDelete.swift rename to Sources/ContainerCommands/System/DNS/DNSDelete.swift diff --git a/Sources/CLI/System/DNS/DNSList.swift b/Sources/ContainerCommands/System/DNS/DNSList.swift similarity index 100% rename from Sources/CLI/System/DNS/DNSList.swift rename to Sources/ContainerCommands/System/DNS/DNSList.swift diff --git a/Sources/CLI/System/Kernel/KernelSet.swift b/Sources/ContainerCommands/System/Kernel/KernelSet.swift similarity index 100% rename from Sources/CLI/System/Kernel/KernelSet.swift rename to Sources/ContainerCommands/System/Kernel/KernelSet.swift diff --git a/Sources/CLI/System/Property/PropertyClear.swift b/Sources/ContainerCommands/System/Property/PropertyClear.swift similarity index 88% rename from Sources/CLI/System/Property/PropertyClear.swift rename to Sources/ContainerCommands/System/Property/PropertyClear.swift index dff042f3..6c69e378 100644 --- a/Sources/CLI/System/Property/PropertyClear.swift +++ b/Sources/ContainerCommands/System/Property/PropertyClear.swift @@ -21,8 +21,10 @@ import ContainerizationError import Foundation extension Application { - struct PropertyClear: AsyncParsableCommand { - static let configuration = CommandConfiguration( + public struct PropertyClear: AsyncParsableCommand { + public init() {} + + public static let configuration = CommandConfiguration( commandName: "clear", abstract: "Clear a property value" ) @@ -33,7 +35,7 @@ extension Application { @Argument(help: "the property ID") var id: String - func run() async throws { + public func run() async throws { guard let key = DefaultsStore.Keys(rawValue: id) else { throw ContainerizationError(.invalidArgument, message: "invalid property ID: \(id)") } diff --git a/Sources/CLI/System/Property/PropertyGet.swift b/Sources/ContainerCommands/System/Property/PropertyGet.swift similarity index 89% rename from Sources/CLI/System/Property/PropertyGet.swift rename to Sources/ContainerCommands/System/Property/PropertyGet.swift index a5bf7c15..909f2cd4 100644 --- a/Sources/CLI/System/Property/PropertyGet.swift +++ b/Sources/ContainerCommands/System/Property/PropertyGet.swift @@ -21,8 +21,10 @@ import ContainerizationError import Foundation extension Application { - struct PropertyGet: AsyncParsableCommand { - static let configuration = CommandConfiguration( + public struct PropertyGet: AsyncParsableCommand { + public init() {} + + public static let configuration = CommandConfiguration( commandName: "get", abstract: "Retrieve a property value" ) @@ -33,7 +35,7 @@ extension Application { @Argument(help: "the property ID") var id: String - func run() async throws { + public func run() async throws { let value = DefaultsStore.allValues() .filter { id == $0.id } .first diff --git a/Sources/CLI/System/Property/PropertyList.swift b/Sources/ContainerCommands/System/Property/PropertyList.swift similarity index 93% rename from Sources/CLI/System/Property/PropertyList.swift rename to Sources/ContainerCommands/System/Property/PropertyList.swift index 2d834c6c..312d109f 100644 --- a/Sources/CLI/System/Property/PropertyList.swift +++ b/Sources/ContainerCommands/System/Property/PropertyList.swift @@ -20,8 +20,10 @@ import ContainerPersistence import Foundation extension Application { - struct PropertyList: AsyncParsableCommand { - static let configuration = CommandConfiguration( + public struct PropertyList: AsyncParsableCommand { + public init() {} + + public static let configuration = CommandConfiguration( commandName: "list", abstract: "List system properties", aliases: ["ls"] @@ -36,7 +38,7 @@ extension Application { @OptionGroup var global: Flags.Global - func run() async throws { + public func run() async throws { let vals = DefaultsStore.allValues() try printValues(vals, format: format) } diff --git a/Sources/CLI/System/Property/PropertySet.swift b/Sources/ContainerCommands/System/Property/PropertySet.swift similarity index 94% rename from Sources/CLI/System/Property/PropertySet.swift rename to Sources/ContainerCommands/System/Property/PropertySet.swift index 4c3deefa..490de221 100644 --- a/Sources/CLI/System/Property/PropertySet.swift +++ b/Sources/ContainerCommands/System/Property/PropertySet.swift @@ -23,8 +23,10 @@ import ContainerizationOCI import Foundation extension Application { - struct PropertySet: AsyncParsableCommand { - static let configuration = CommandConfiguration( + public struct PropertySet: AsyncParsableCommand { + public init() {} + + public static let configuration = CommandConfiguration( commandName: "set", abstract: "Set a property value" ) @@ -38,7 +40,7 @@ extension Application { @Argument(help: "the property value") var value: String - func run() async throws { + public func run() async throws { guard let key = DefaultsStore.Keys(rawValue: id) else { throw ContainerizationError(.invalidArgument, message: "invalid property ID: \(id)") } diff --git a/Sources/CLI/System/SystemCommand.swift b/Sources/ContainerCommands/System/SystemCommand.swift similarity index 100% rename from Sources/CLI/System/SystemCommand.swift rename to Sources/ContainerCommands/System/SystemCommand.swift diff --git a/Sources/CLI/System/SystemDNS.swift b/Sources/ContainerCommands/System/SystemDNS.swift similarity index 100% rename from Sources/CLI/System/SystemDNS.swift rename to Sources/ContainerCommands/System/SystemDNS.swift diff --git a/Sources/CLI/System/SystemKernel.swift b/Sources/ContainerCommands/System/SystemKernel.swift similarity index 100% rename from Sources/CLI/System/SystemKernel.swift rename to Sources/ContainerCommands/System/SystemKernel.swift diff --git a/Sources/CLI/System/SystemLogs.swift b/Sources/ContainerCommands/System/SystemLogs.swift similarity index 100% rename from Sources/CLI/System/SystemLogs.swift rename to Sources/ContainerCommands/System/SystemLogs.swift diff --git a/Sources/CLI/System/SystemProperty.swift b/Sources/ContainerCommands/System/SystemProperty.swift similarity index 100% rename from Sources/CLI/System/SystemProperty.swift rename to Sources/ContainerCommands/System/SystemProperty.swift diff --git a/Sources/CLI/System/SystemStart.swift b/Sources/ContainerCommands/System/SystemStart.swift similarity index 100% rename from Sources/CLI/System/SystemStart.swift rename to Sources/ContainerCommands/System/SystemStart.swift diff --git a/Sources/CLI/System/SystemStatus.swift b/Sources/ContainerCommands/System/SystemStatus.swift similarity index 100% rename from Sources/CLI/System/SystemStatus.swift rename to Sources/ContainerCommands/System/SystemStatus.swift diff --git a/Sources/CLI/System/SystemStop.swift b/Sources/ContainerCommands/System/SystemStop.swift similarity index 100% rename from Sources/CLI/System/SystemStop.swift rename to Sources/ContainerCommands/System/SystemStop.swift diff --git a/Sources/CLI/Volume/VolumeCommand.swift b/Sources/ContainerCommands/Volume/VolumeCommand.swift similarity index 100% rename from Sources/CLI/Volume/VolumeCommand.swift rename to Sources/ContainerCommands/Volume/VolumeCommand.swift diff --git a/Sources/CLI/Volume/VolumeCreate.swift b/Sources/ContainerCommands/Volume/VolumeCreate.swift similarity index 100% rename from Sources/CLI/Volume/VolumeCreate.swift rename to Sources/ContainerCommands/Volume/VolumeCreate.swift diff --git a/Sources/CLI/Volume/VolumeDelete.swift b/Sources/ContainerCommands/Volume/VolumeDelete.swift similarity index 100% rename from Sources/CLI/Volume/VolumeDelete.swift rename to Sources/ContainerCommands/Volume/VolumeDelete.swift diff --git a/Sources/CLI/Volume/VolumeInspect.swift b/Sources/ContainerCommands/Volume/VolumeInspect.swift similarity index 100% rename from Sources/CLI/Volume/VolumeInspect.swift rename to Sources/ContainerCommands/Volume/VolumeInspect.swift diff --git a/Sources/CLI/Volume/VolumeList.swift b/Sources/ContainerCommands/Volume/VolumeList.swift similarity index 100% rename from Sources/CLI/Volume/VolumeList.swift rename to Sources/ContainerCommands/Volume/VolumeList.swift