diff --git a/Package.swift b/Package.swift index 66cc661..3992818 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/g-Off/XcodeProject.git", from: "0.5.0-alpha.5"), + .package(url: "https://github.com/g-Off/XcodeProject.git", from: "0.5.0"), .package(url: "https://github.com/g-Off/CommandRegistry.git", from: "0.1.2") ], targets: [ diff --git a/README.md b/README.md index d4e41fb..625a707 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,3 @@ A simple command line tool for sorting and syncing an Xcode project file. * Groups can be sorted (recursively if desired) either alphabetically or by type. * Groups can be synchronized (recursively if desired) with their on disk folder. This will add new files and folders and delete ones that are no longer present. - -## Building - -Use the included Makefile, otherwise you'll need to include a few build options to make the tool build using macOS 10.11+ (instead of Swift Package Managers hardcoded macOS 10.10). diff --git a/Sources/xcoder/Commands/SaveCommand.swift b/Sources/xcoder/Commands/SaveCommand.swift index 4c7930b..b3505fb 100644 --- a/Sources/xcoder/Commands/SaveCommand.swift +++ b/Sources/xcoder/Commands/SaveCommand.swift @@ -11,7 +11,7 @@ import CommandRegistry public struct SaveCommand: Command { private struct SaveArguments { - var xcodeproj: AbsolutePath = localFileSystem.currentWorkingDirectory! + var xcodeProjects: [AbsolutePath] = [localFileSystem.currentWorkingDirectory!] } public let command: String = "save" @@ -20,8 +20,8 @@ public struct SaveCommand: Command { public init(parser: ArgumentParser) { let subparser = parser.add(subparser: command, overview: overview) - binder.bind(positional: subparser.add(positional: "xcodeproj", kind: PathArgument.self, optional: false, usage: "Xcode Project file.", completion: .filename)) { (syncArguments, xcodeproj) in - syncArguments.xcodeproj = xcodeproj.path + binder.bind(positional: subparser.add(positional: "xcodeproj", kind: [PathArgument].self, optional: false, usage: "Xcode Project file.", completion: .filename)) { (syncArguments, xcodeProjects) in + syncArguments.xcodeProjects = xcodeProjects.map { $0.path } } } @@ -29,12 +29,14 @@ public struct SaveCommand: Command { var arguments = SaveArguments() try binder.fill(parseResult: parsedArguments, into: &arguments) - let projectFile: ProjectFile - do { - projectFile = try ProjectFile(url: Foundation.URL(fileURLWithPath: arguments.xcodeproj.asString)) - } catch { - throw Error.invalidProject(path: arguments.xcodeproj.asString) + for path in arguments.xcodeProjects { + let projectFile: ProjectFile + do { + projectFile = try ProjectFile(url: Foundation.URL(fileURLWithPath: path.asString)) + } catch { + throw Error.invalidProject(path: path.asString) + } + try projectFile.save() } - try projectFile.save() } } diff --git a/Sources/xcoder/Version.swift b/Sources/xcoder/Version.swift index 0e9fb3d..fc6e17a 100644 --- a/Sources/xcoder/Version.swift +++ b/Sources/xcoder/Version.swift @@ -1,5 +1,5 @@ import CommandRegistry extension Version { - static var current: Version = "0.3.5" + static var current: Version = "0.3.6" } diff --git a/Sources/xcoder/main.swift b/Sources/xcoder/main.swift index c2764e8..87e6553 100644 --- a/Sources/xcoder/main.swift +++ b/Sources/xcoder/main.swift @@ -6,4 +6,5 @@ registry.register(command: CompletionToolCommand.self) registry.register(command: SyncCommand.self) registry.register(command: GroupSortCommand.self) registry.register(command: BuildPhaseSortCommand.self) +registry.register(command: SaveCommand.self) registry.run()