From 016feb61c63232e0b5af643303cee26d9a511391 Mon Sep 17 00:00:00 2001 From: Henrik Panhans Date: Thu, 13 Apr 2023 15:10:00 +0200 Subject: [PATCH] Maintenance (#9) --- .github/workflows/swift.yml | 19 ++++++++----------- Package.resolved | 4 ++-- Package.swift | 6 +++--- .../{main.swift => SwiftGenStrings.swift} | 11 ++++++++--- 4 files changed, 21 insertions(+), 19 deletions(-) rename Sources/SwiftGenStrings/{main.swift => SwiftGenStrings.swift} (95%) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 95a5afc..8f0e479 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -2,21 +2,18 @@ name: Swift on: push: - branches: [ master ] + branches: [main] pull_request: - branches: [ master ] + branches: [main] jobs: build: - runs-on: macos-latest steps: - - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - uses: actions/checkout@v2 - - name: Build - run: swift build -v - - name: Run tests - run: swift test -v + - name: Checkout code + uses: actions/checkout@v3 + - name: Build package + run: swift build -v + - name: Run tests + run: swift test -v diff --git a/Package.resolved b/Package.resolved index 228d9c6..e755f5b 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "92646c0cdbaca076c8d3d0207891785b3379cbff", - "version": "0.3.1" + "revision": "fee6933f37fde9a5e12a1e4aeaa93fe60116ff2a", + "version": "1.2.2" } } ] diff --git a/Package.swift b/Package.swift index 199018f..f966a54 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.3 +// swift-tools-version:5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -16,12 +16,12 @@ let package = Package( ), ], dependencies: [ - .package(url: "https://github.com/apple/swift-argument-parser", from: "0.3.0") + .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0") ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. // Targets can depend on other targets in this package, and on products in packages this package depends on. - .target( + .executableTarget( name: "SwiftGenStrings", dependencies: [ "SwiftGenStringsCore", diff --git a/Sources/SwiftGenStrings/main.swift b/Sources/SwiftGenStrings/SwiftGenStrings.swift similarity index 95% rename from Sources/SwiftGenStrings/main.swift rename to Sources/SwiftGenStrings/SwiftGenStrings.swift index ba94e10..5d3cb5b 100644 --- a/Sources/SwiftGenStrings/main.swift +++ b/Sources/SwiftGenStrings/SwiftGenStrings.swift @@ -2,8 +2,11 @@ import ArgumentParser import Foundation import SwiftGenStringsCore +@main struct SwiftGenStrings: ParsableCommand { + // MARK: - Configuration + private static var abstract = """ SwiftGenStrings is a command line application that can be used as a drop-in replacement for the standard genstrings command for Swift sources. The latter only supports the short form of the NSLocalizedString function but breaks as soon as you use any parameters other than key and comment as in @@ -12,10 +15,12 @@ struct SwiftGenStrings: ParsableCommand { static let configuration = CommandConfiguration( commandName: "SwiftGenStrings", abstract: SwiftGenStrings.abstract, - version: "0.0.2", + version: "0.1.0", helpNames: .shortAndLong ) + // MARK: - Arguments and Options + @Argument(help: "List of files, that are used as source of Localizable.strings generation.") var files: [URL] @@ -25,6 +30,8 @@ struct SwiftGenStrings: ParsableCommand { @Option(name: .short, help: "(Optional) Specifies what directory Localizable.strings table is created in. Not specifying output directory will print script output content to standard output (console).") var outputDirectory: URL? + // MARK: - Processing + func run() throws { do { try ky_run() @@ -68,5 +75,3 @@ struct SwiftGenStrings: ParsableCommand { } } - -SwiftGenStrings.main()