Skip to content

Commit

Permalink
Use asc for token creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackjacx committed Aug 25, 2023
1 parent 0ac5c7b commit 83a537d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
9 changes: 0 additions & 9 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 2 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
26 changes: 17 additions & 9 deletions Sources/ASC/commands/sub/Keys.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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)
}
}
}

0 comments on commit 83a537d

Please sign in to comment.