Skip to content

Commit ca6d9f5

Browse files
committed
Implement basic pull beta groups command
1 parent aefdb40 commit ca6d9f5

4 files changed

Lines changed: 76 additions & 0 deletions

File tree

Sources/AppStoreConnectCLI/Commands/TestFlight/BetaGroups/BetaGroupCommand.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ struct TestFlightBetaGroupCommand: ParsableCommand {
1818
ReadBetaGroupCommand.self,
1919
RemoveTestersFromGroupCommand.self,
2020
AddTestersToGroupCommand.self,
21+
SyncBetaGroupsCommand.self,
2122
],
2223
defaultSubcommand: ListBetaGroupsCommand.self
2324
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2020 Itty Bitty Apps Pty Ltd
2+
3+
import ArgumentParser
4+
import FileSystem
5+
6+
struct PullBetaGroupsCommand: CommonParsableCommand {
7+
8+
static var configuration = CommandConfiguration(
9+
commandName: "pull",
10+
abstract: "Pull down server beta groups, refresh local beta group config files"
11+
)
12+
13+
@OptionGroup()
14+
var common: CommonOptions
15+
16+
@Option(
17+
default: "./config/betagroups",
18+
help: "Path to the Folder containing the information about beta groups. (default: './config/betagroups')"
19+
) var outputPath: String
20+
21+
func run() throws {
22+
let service = try makeService()
23+
24+
let betaGroupWithTesters = try service.pullBetaGroups()
25+
26+
try BetaGroupProcessor(path: .folder(path: outputPath))
27+
.write(groupsWithTesters: betaGroupWithTesters)
28+
}
29+
30+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright 2020 Itty Bitty Apps Pty Ltd
2+
3+
import ArgumentParser
4+
import struct Model.BetaGroup
5+
6+
struct PushBetaGroupsCommand: CommonParsableCommand {
7+
8+
static var configuration = CommandConfiguration(
9+
commandName: "push",
10+
abstract: "Push local beta group config files to server, update server beta groups"
11+
)
12+
13+
@OptionGroup()
14+
var common: CommonOptions
15+
16+
@Option(
17+
default: "./config/betagroups",
18+
help: "Path to the Folder containing the information about beta groups. (default: './config/betagroups')"
19+
) var inputPath: String
20+
21+
@Flag(help: "Perform a dry run.")
22+
var dryRun: Bool
23+
24+
func run() throws {
25+
26+
}
27+
28+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2020 Itty Bitty Apps Pty Ltd
2+
3+
import ArgumentParser
4+
5+
struct SyncBetaGroupsCommand: ParsableCommand {
6+
static var configuration = CommandConfiguration(
7+
commandName: "sync",
8+
abstract: """
9+
Sync information about beta groups with provided configuration file.
10+
""",
11+
subcommands: [
12+
PullBetaGroupsCommand.self,
13+
PushBetaGroupsCommand.self,
14+
],
15+
defaultSubcommand: PullBetaGroupsCommand.self
16+
)
17+
}

0 commit comments

Comments
 (0)