diff --git a/Package.resolved b/Package.resolved index de392f7..b80f38d 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,14 +1,5 @@ { "pins" : [ - { - "identity" : "asckit", - "kind" : "remoteSourceControl", - "location" : "https://github.com/blackjacx/ASCKit", - "state" : { - "revision" : "bf8165371166baf312ee202361df4e25c4c0bce2", - "version" : "0.2.1" - } - }, { "identity" : "engine", "kind" : "remoteSourceControl", diff --git a/Package.swift b/Package.swift index 41b8db3..1906a81 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,8 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/blackjacx/Engine", from: "0.0.3"), - .package(url: "https://github.com/blackjacx/ASCKit", from: "0.2.1"), + .package(path: "../ASCKit"), +// .package(url: "https://github.com/blackjacx/ASCKit", from: "0.2.1"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"), .package(url: "https://github.com/vapor/jwt-kit.git", from: "4.1.0"), .package(url: "https://github.com/kareman/SwiftShell", from: "5.1.0") diff --git a/Sources/ASC/commands/sub/Keys.swift b/Sources/ASC/commands/sub/Keys.swift index 1c25c15..06f6ccd 100644 --- a/Sources/ASC/commands/sub/Keys.swift +++ b/Sources/ASC/commands/sub/Keys.swift @@ -17,7 +17,7 @@ extension ASC { static var configuration = CommandConfiguration( abstract: "Lists, registers and deletes App Store Connect API keys on your Mac.", - subcommands: [List.self, Activate.self, Register.self, Delete.self], + subcommands: [List.self, Activate.self, Register.self, Delete.self, Token.self], defaultSubcommand: List.self) } } @@ -28,8 +28,6 @@ extension ASC.Keys { struct List: ParsableCommand { static var configuration = CommandConfiguration(abstract: "List locally stored App Store Connect API keys.") - // The `@OptionGroup` attribute includes the flags, options, and arguments defined by another - // `ParsableArguments` type. @OptionGroup() var options: Options @@ -42,8 +40,6 @@ extension ASC.Keys { struct Activate: ParsableCommand { static var configuration = CommandConfiguration(abstract: "Makes a registered API key the default one.") - // The `@OptionGroup` attribute includes the flags, options, and arguments defined by another - // `ParsableArguments` type. @OptionGroup() var options: Options @@ -60,8 +56,6 @@ extension ASC.Keys { struct Register: ParsableCommand { static var configuration = CommandConfiguration(abstract: "Registers App Store Connect API keys locally.") - // The `@OptionGroup` attribute includes the flags, options, and arguments defined by another - // `ParsableArguments` type. @OptionGroup() var options: Options @@ -88,8 +82,6 @@ extension ASC.Keys { struct Delete: ParsableCommand { static var configuration = CommandConfiguration(abstract: "Delete locally stored App Store Connect API keys.") - // The `@OptionGroup` attribute includes the flags, options, and arguments defined by another - // `ParsableArguments` type. @OptionGroup() var options: Options @@ -101,4 +93,20 @@ extension ASC.Keys { print(deletedKey) } } + + /// Generate a token from a locally stored App Store Connect API keys. + struct Token: ParsableCommand { + static var configuration = CommandConfiguration(abstract: "Generate a token from a locally stored App Store Connect API keys.") + + @OptionGroup() + var options: Options + + @Option(name: .shortAndLong, help: "The key's id.") + var id: String? + + func run() throws { + let token = try ASCService.createAccessToken(id: id) + print(token) + } + } }