-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Embed Program into library to simplify main (#572)
Following [this suggestion](apple/swift-argument-parser#688 (comment)), thanks!
- Loading branch information
Showing
2 changed files
with
18 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import ArgumentParser | ||
import Foundation | ||
|
||
public struct Program: AsyncParsableCommand { | ||
public static let configuration = CommandConfiguration( | ||
commandName: "tunes", | ||
abstract: "A tool for working with iTunes data.", | ||
version: iTunesVersion, | ||
subcommands: [BackupCommand.self, PatchCommand.self, RepairCommand.self, BatchCommand.self], | ||
defaultSubcommand: BackupCommand.self | ||
) | ||
|
||
public init() {} // This is public and empty to help the compiler. | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
import ArgumentParser | ||
import Foundation | ||
import iTunes | ||
|
||
@main | ||
public struct Program: AsyncParsableCommand { | ||
public static let configuration = CommandConfiguration( | ||
commandName: "tunes", | ||
abstract: "A tool for working with iTunes data.", | ||
version: iTunesVersion, | ||
subcommands: [BackupCommand.self, PatchCommand.self, RepairCommand.self, BatchCommand.self], | ||
defaultSubcommand: BackupCommand.self | ||
) | ||
|
||
public init() {} // This is public and empty to help the compiler. | ||
public struct Main { | ||
static func main() async { | ||
await Program.main() | ||
} | ||
} |