Skip to content

Commit

Permalink
rename entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
417-72KI committed Oct 1, 2023
1 parent dbe231e commit 2b2154e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Foundation
import PathKit

@main
struct BuildConfigSwift: ParsableCommand {
struct App: ParsableCommand {
@Option(name: .shortAndLong, help: "The directory to output BuildConfig.plist and BuildConfig.generated.swift.")
var outputDirectory: String = "./"

Expand All @@ -16,13 +16,16 @@ struct BuildConfigSwift: ParsableCommand {
var srcDir: String
}

extension BuildConfigSwift {
extension App {
static var configuration: CommandConfiguration {
CommandConfiguration(version: ApplicationInfo.version)
CommandConfiguration(
commandName: "buildconfigswift",
version: ApplicationInfo.version
)
}
}

extension BuildConfigSwift {
extension App {
func run() throws {
let outputDirectory = Path(outputDirectory)
let environment = environment.flatMap { $0.isEmpty ? nil : $0 }
Expand Down
8 changes: 4 additions & 4 deletions Tests/buildconfigswiftTests/BuildConfigswiftTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ final class BuildConfigswiftTests: XCTestCase {
XCTAssertEqual(process.exitCode, .validationFailure)
XCTAssertEqual(stderr.outputString, """
Error: SCRIPT_INPUT_FILE_COUNT must be Int. Invalid value `foo`
Usage: build-config-swift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'build-config-swift --help' for more information.
Usage: buildconfigswift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'buildconfigswift --help' for more information.
""")
}
try context("SCRIPT_OUTPUT_FILE_COUNT") {
Expand All @@ -161,8 +161,8 @@ final class BuildConfigswiftTests: XCTestCase {
XCTAssertEqual(process.exitCode, .validationFailure)
XCTAssertEqual(stderr.outputString, """
Error: SCRIPT_OUTPUT_FILE_COUNT must be Int. Invalid value `bar`
Usage: build-config-swift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'build-config-swift --help' for more information.
Usage: buildconfigswift [--output-directory <output-directory>] [--environment <environment>] <src-dir>
See 'buildconfigswift --help' for more information.
""")
}
}
Expand Down

0 comments on commit 2b2154e

Please sign in to comment.