Skip to content

Commit

Permalink
Merge pull request #33 from codeOfRobin/master
Browse files Browse the repository at this point in the history
Added --force
  • Loading branch information
JohnSundell authored Jan 14, 2017
2 parents 26ec0be + 1668f2f commit 40cefda
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Besides using the guide to input information, SwiftPlate also supports command l
| GitHub URL | Any URL you'll be hosting the project at (for Podspec) | `--url` | `-u` |
| Organization name | The name of your organization | `--organization` | `-o` |
| Repo | Any custom SwiftPlate repository that should be used for templates | `--repo` | `-r` |
| Force | Prevent user prompt at the end (for CIs etc.) | `--force` | `-f` |

## Questions or feedback?

Expand Down
2 changes: 1 addition & 1 deletion SwiftPlate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

/* Begin PBXFileReference section */
52CC95EA1DE1DF29000B8859 /* swiftplate */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = swiftplate; sourceTree = BUILT_PRODUCTS_DIR; };
52CC95F41DE1DF51000B8859 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
52CC95F41DE1DF51000B8859 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; usesTabs = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down
Binary file added main
Binary file not shown.
9 changes: 7 additions & 2 deletions main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct Arguments {
var githubURL: String?
var organizationName: String?
var repositoryURL: URL?
var forceEnabled: Bool = false

init(commandLineArguments arguments: [String]) {
for (index, argument) in arguments.enumerated() {
Expand All @@ -97,6 +98,8 @@ struct Arguments {
if let urlString = arguments.element(after: index) {
repositoryURL = URL(string: urlString)
}
case "--force", "-f":
forceEnabled = true
default:
break
}
Expand Down Expand Up @@ -263,8 +266,10 @@ if let organizationName = organizationName {

print("---------------------------------------------------------------------")

if !askForBooleanInfo(question: "Proceed? ✅") {
exit(0)
if !arguments.forceEnabled {
if !askForBooleanInfo(question: "Proceed? ✅") {
exit(0)
}
}

print("🚀 Starting to generate project \(projectName)...")
Expand Down

0 comments on commit 40cefda

Please sign in to comment.