case let .specifiedTargets(targets): try targets.compactMap { switch gitHubClient.getUser(by: $0) { case let .success(user): return user case let .failure(error): dumpWarn(error) return nil } } .forEach(star(to:)) } }
{ case let .specifiedTargets(targets): for target in targets { do { let user = try await gitHubClient.getUser(by: target) try await star(to: user) } catch { dumpWarn(error) } } } }
name to give stars.") var targets: [String] @Option(name: [.customLong("github-token"), .customShort("t")], help: "GitHub Token to give stars. If not set, use `SSGH_TOKEN` in environment.") var gitHubToken: String? @Flag(name: [.customLong("dry-run"), .short], help: "dry-run mode. Only fetch lists to give stars.") var dryRunMode = false }
user name to give stars.") var targets: [String] @Option(name: [.customLong("github-token"), .customShort("t")], help: "GitHub Token to give stars. If not set, use `SSGH_TOKEN` in environment.") var gitHubToken: String? @Flag(name: [.customLong("dry-run"), .short], help: "dry-run mode. Only fetch lists to give stars.") var dryRunMode = false }
= SSGH } struct SSGH: AsyncParsableCommand { @Argument(help: "GitHub user name to give stars.") var targets: [String] @Option(name: [.customLong("github-token"), .customShort("t")], help: "GitHub Token to give stars. If not set, use `SSGH_TOKEN` in environment.") var gitHubToken: String? @Flag(name: [.customLong("dry-run"), .short], help: "dry-run mode. Only fetch lists to give stars.") var dryRunMode = false } IUUQTHJUIVCDPNBQQMFTXJGUBSHVNFOUQBSTFSQVMM