From 3deea587a97bef4e351c8e1f7130c5b72c8cf5a7 Mon Sep 17 00:00:00 2001 From: Kyle Fuller Date: Fri, 4 Dec 2015 15:31:02 +0000 Subject: [PATCH] Add Swift Package Manager support --- .gitignore | 1 + Commander.podspec.json | 4 +-- Commander/Commander.h | 7 ----- Commander/Info.plist | 28 ------------------- Package.swift | 5 ++++ .../ArgumentConvertible.swift | 0 .../ArgumentDescription.swift | 0 {Commander => Sources}/ArgumentParser.swift | 11 ++++---- {Commander => Sources}/Command.swift | 0 {Commander => Sources}/CommandDarwin.swift | 0 {Commander => Sources}/CommandType.swift | 0 {Commander => Sources}/Commands.swift | 0 {Commander => Sources}/Group.swift | 0 .../ArgumentConvertibleSpec.swift | 0 .../ArgumentParserSpec.swift | 0 {CommanderSpecs => Specs}/CommandSpec.swift | 0 .../CommandTypeSpec.swift | 0 {CommanderSpecs => Specs}/GroupSpec.swift | 0 18 files changed, 14 insertions(+), 42 deletions(-) delete mode 100644 Commander/Commander.h delete mode 100644 Commander/Info.plist create mode 100644 Package.swift rename {Commander => Sources}/ArgumentConvertible.swift (100%) rename {Commander => Sources}/ArgumentDescription.swift (100%) rename {Commander => Sources}/ArgumentParser.swift (96%) rename {Commander => Sources}/Command.swift (100%) rename {Commander => Sources}/CommandDarwin.swift (100%) rename {Commander => Sources}/CommandType.swift (100%) rename {Commander => Sources}/Commands.swift (100%) rename {Commander => Sources}/Group.swift (100%) rename {CommanderSpecs => Specs}/ArgumentConvertibleSpec.swift (100%) rename {CommanderSpecs => Specs}/ArgumentParserSpec.swift (100%) rename {CommanderSpecs => Specs}/CommandSpec.swift (100%) rename {CommanderSpecs => Specs}/CommandTypeSpec.swift (100%) rename {CommanderSpecs => Specs}/GroupSpec.swift (100%) diff --git a/.gitignore b/.gitignore index cbc7673..f310e48 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .conche/ +/.build/ diff --git a/Commander.podspec.json b/Commander.podspec.json index 6df4a14..4a28ac0 100644 --- a/Commander.podspec.json +++ b/Commander.podspec.json @@ -15,13 +15,13 @@ "git": "https://github.com/kylef/Commander.git", "tag": "0.3.0" }, - "source_files": "Commander/*.{h,swift}", + "source_files": "Sources/*.{h,swift}", "platforms": { "ios": "8.0", "osx": "10.9" }, "test_specification": { - "source_files": "CommanderSpecs/*Spec.swift", + "source_files": "Specs/*Spec.swift", "dependencies": { "Spectre": [ "~> 0.5.0" ] } diff --git a/Commander/Commander.h b/Commander/Commander.h deleted file mode 100644 index 3c2db63..0000000 --- a/Commander/Commander.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -//! Project version number for Commander. -FOUNDATION_EXPORT double CommanderVersionNumber; - -//! Project version string for Commander. -FOUNDATION_EXPORT const unsigned char CommanderVersionString[]; diff --git a/Commander/Info.plist b/Commander/Info.plist deleted file mode 100644 index ba3fdf1..0000000 --- a/Commander/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSHumanReadableCopyright - Copyright © 2015 Cocode. All rights reserved. - NSPrincipalClass - - - diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..19109d0 --- /dev/null +++ b/Package.swift @@ -0,0 +1,5 @@ +import PackageDescription + +let package = Package( + name: "Commander" +) diff --git a/Commander/ArgumentConvertible.swift b/Sources/ArgumentConvertible.swift similarity index 100% rename from Commander/ArgumentConvertible.swift rename to Sources/ArgumentConvertible.swift diff --git a/Commander/ArgumentDescription.swift b/Sources/ArgumentDescription.swift similarity index 100% rename from Commander/ArgumentDescription.swift rename to Sources/ArgumentDescription.swift diff --git a/Commander/ArgumentParser.swift b/Sources/ArgumentParser.swift similarity index 96% rename from Commander/ArgumentParser.swift rename to Sources/ArgumentParser.swift index 7cc5773..bddc2fc 100644 --- a/Commander/ArgumentParser.swift +++ b/Sources/ArgumentParser.swift @@ -171,13 +171,14 @@ public final class ArgumentParser : ArgumentConvertible, CustomStringConvertible var index = 0 for argument in arguments { switch argument { - case .Flag(var option): - if option.contains(flag) { - option.remove(flag) + case .Flag(let option): + var options = option + if options.contains(flag) { + options.remove(flag) arguments.removeAtIndex(index) - if !option.isEmpty { - arguments.insert(.Flag(option), atIndex: index) + if !options.isEmpty { + arguments.insert(.Flag(options), atIndex: index) } return true } diff --git a/Commander/Command.swift b/Sources/Command.swift similarity index 100% rename from Commander/Command.swift rename to Sources/Command.swift diff --git a/Commander/CommandDarwin.swift b/Sources/CommandDarwin.swift similarity index 100% rename from Commander/CommandDarwin.swift rename to Sources/CommandDarwin.swift diff --git a/Commander/CommandType.swift b/Sources/CommandType.swift similarity index 100% rename from Commander/CommandType.swift rename to Sources/CommandType.swift diff --git a/Commander/Commands.swift b/Sources/Commands.swift similarity index 100% rename from Commander/Commands.swift rename to Sources/Commands.swift diff --git a/Commander/Group.swift b/Sources/Group.swift similarity index 100% rename from Commander/Group.swift rename to Sources/Group.swift diff --git a/CommanderSpecs/ArgumentConvertibleSpec.swift b/Specs/ArgumentConvertibleSpec.swift similarity index 100% rename from CommanderSpecs/ArgumentConvertibleSpec.swift rename to Specs/ArgumentConvertibleSpec.swift diff --git a/CommanderSpecs/ArgumentParserSpec.swift b/Specs/ArgumentParserSpec.swift similarity index 100% rename from CommanderSpecs/ArgumentParserSpec.swift rename to Specs/ArgumentParserSpec.swift diff --git a/CommanderSpecs/CommandSpec.swift b/Specs/CommandSpec.swift similarity index 100% rename from CommanderSpecs/CommandSpec.swift rename to Specs/CommandSpec.swift diff --git a/CommanderSpecs/CommandTypeSpec.swift b/Specs/CommandTypeSpec.swift similarity index 100% rename from CommanderSpecs/CommandTypeSpec.swift rename to Specs/CommandTypeSpec.swift diff --git a/CommanderSpecs/GroupSpec.swift b/Specs/GroupSpec.swift similarity index 100% rename from CommanderSpecs/GroupSpec.swift rename to Specs/GroupSpec.swift