From 11535d1d8e0c2b7779854f92adf7e51e9830daf6 Mon Sep 17 00:00:00 2001 From: KC-2001MS Date: Tue, 30 Jul 2024 22:06:09 +0900 Subject: [PATCH] Some minor corrections --- .swiftpm/configuration/Package.resolved | 6 +-- ...Package.xcscheme => SwiftLITests.xcscheme} | 48 ------------------- Package.swift | 14 ++---- Package@swift-6.0.swift | 43 +++++++++++++++++ README.md | 2 +- Sources/SwiftLI/Style/BlinkStyle.swift | 2 +- Sources/SwiftLI/Style/Color.swift | 2 +- Sources/SwiftLI/Style/LineStyle.swift | 2 +- Sources/SwiftLI/Style/Weight.swift | 2 +- Sources/sclt/Subcommands/Break.swift | 2 +- Sources/sclt/Subcommands/Group.swift | 2 +- Sources/sclt/Subcommands/HDivider.swift | 2 +- Sources/sclt/Subcommands/Label.swift | 2 +- Sources/sclt/Subcommands/Spacer.swift | 2 +- Sources/sclt/Subcommands/SwiftLogo.swift | 2 +- Sources/sclt/Subcommands/Text.swift | 2 +- Sources/sclt/SwiftLI.swift | 2 +- Tests/SwiftLITests/SwiftLITests.swift | 10 ++-- 18 files changed, 68 insertions(+), 79 deletions(-) rename .swiftpm/xcode/xcshareddata/xcschemes/{SwiftLI-Package.xcscheme => SwiftLITests.xcscheme} (51%) create mode 100644 Package@swift-6.0.swift diff --git a/.swiftpm/configuration/Package.resolved b/.swiftpm/configuration/Package.resolved index fa91f3b..b94fdad 100644 --- a/.swiftpm/configuration/Package.resolved +++ b/.swiftpm/configuration/Package.resolved @@ -1,13 +1,13 @@ { - "originHash" : "1497425b214219aecb92bd89498fd7890755d32f185234884ef4d94b88c5d4b7", + "originHash" : "f8e6a1eb55a5e389ff30f3022787f2ae6f05ba7e54bde01c50cc53f7612297a1", "pins" : [ { "identity" : "swift-argument-parser", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser", "state" : { - "revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b", - "version" : "1.4.0" + "revision" : "41982a3656a71c768319979febd796c6fd111d5c", + "version" : "1.5.0" } }, { diff --git a/.swiftpm/xcode/xcshareddata/xcschemes/SwiftLI-Package.xcscheme b/.swiftpm/xcode/xcshareddata/xcschemes/SwiftLITests.xcscheme similarity index 51% rename from .swiftpm/xcode/xcshareddata/xcschemes/SwiftLI-Package.xcscheme rename to .swiftpm/xcode/xcshareddata/xcschemes/SwiftLITests.xcscheme index 448c1d7..1c7a775 100644 --- a/.swiftpm/xcode/xcshareddata/xcschemes/SwiftLI-Package.xcscheme +++ b/.swiftpm/xcode/xcshareddata/xcschemes/SwiftLITests.xcscheme @@ -6,36 +6,6 @@ parallelizeBuildables = "YES" buildImplicitDependencies = "YES" buildArchitectures = "Automatic"> - - - - - - - - - - - - - - - - - - diff --git a/Package.swift b/Package.swift index efab6cc..7146257 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.10 +// swift-tools-version: 5.9 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -16,9 +16,8 @@ let package = Package( .executable(name: "sclt", targets: ["sclt"]) ], dependencies: [ - .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.4.0"), - .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"), - .package(url: "https://github.com/apple/swift-testing.git", from: "0.10.0"), + .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"), + .package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.3.0"), ], targets: [ // Targets are the basic building blocks of a package, defining a module or a test suite. @@ -32,12 +31,5 @@ let package = Package( "SwiftLI" ] ), - .testTarget( - name: "SwiftLITests", - dependencies: [ - .product(name: "Testing", package: "swift-testing"), - "SwiftLI" - ] - ), ] ) diff --git a/Package@swift-6.0.swift b/Package@swift-6.0.swift new file mode 100644 index 0000000..f19b11d --- /dev/null +++ b/Package@swift-6.0.swift @@ -0,0 +1,43 @@ +// swift-tools-version: 6.0 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "SwiftLI", + platforms: [ + .macOS(.v11), + ], + products: [ + .library( + name: "SwiftLI", + targets: ["SwiftLI"] + ), + .executable(name: "sclt", targets: ["sclt"]) + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"), + .package(url: "https://github.com/apple/swift-docc-plugin.git", from: "1.3.0"), + .package(url: "https://github.com/apple/swift-testing.git", from: "0.10.0"), + ], + targets: [ + // Targets are the basic building blocks of a package, defining a module or a test suite. + // Targets can depend on other targets in this package and products from dependencies. + .target( + name: "SwiftLI"), + .executableTarget( + name: "sclt", + dependencies: [ + .product(name: "ArgumentParser", package: "swift-argument-parser"), + "SwiftLI" + ] + ), + .testTarget( + name: "SwiftLITests", + dependencies: [ + .product(name: "Testing", package: "swift-testing"), + "SwiftLI" + ] + ), + ] +) diff --git a/README.md b/README.md index 3024cd4..4cd82bf 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The following environment is required to use this library.

- + Twitter: @IroIro1234work diff --git a/Sources/SwiftLI/Style/BlinkStyle.swift b/Sources/SwiftLI/Style/BlinkStyle.swift index 80e3376..3417888 100644 --- a/Sources/SwiftLI/Style/BlinkStyle.swift +++ b/Sources/SwiftLI/Style/BlinkStyle.swift @@ -7,7 +7,7 @@ /// Blinking Method -public enum BlinkStyle: String, CaseIterable { +public enum BlinkStyle: String, CaseIterable, Sendable { case none = "0" case `default` = "5" // Removed because it does not work with macOS terminal app diff --git a/Sources/SwiftLI/Style/Color.swift b/Sources/SwiftLI/Style/Color.swift index fc6d963..3b73f14 100644 --- a/Sources/SwiftLI/Style/Color.swift +++ b/Sources/SwiftLI/Style/Color.swift @@ -7,7 +7,7 @@ /// A representation of a color that adapts to a given context. -public enum Color { +public enum Color: Sendable { case black case red diff --git a/Sources/SwiftLI/Style/LineStyle.swift b/Sources/SwiftLI/Style/LineStyle.swift index 55b8d19..842d8cd 100644 --- a/Sources/SwiftLI/Style/LineStyle.swift +++ b/Sources/SwiftLI/Style/LineStyle.swift @@ -7,7 +7,7 @@ /// Specify the line type of the Divider -public enum LineStyle: CaseIterable { +public enum LineStyle: CaseIterable, Sendable { case `default` case double_line } diff --git a/Sources/SwiftLI/Style/Weight.swift b/Sources/SwiftLI/Style/Weight.swift index 470c719..b226112 100644 --- a/Sources/SwiftLI/Style/Weight.swift +++ b/Sources/SwiftLI/Style/Weight.swift @@ -7,7 +7,7 @@ /// A weight to use for fonts. -public enum Weight: String, CaseIterable { +public enum Weight: String, CaseIterable, Sendable { case `default` = "0" case bold = "1" case thin = "2" diff --git a/Sources/sclt/Subcommands/Break.swift b/Sources/sclt/Subcommands/Break.swift index 0834f6d..cf29308 100644 --- a/Sources/sclt/Subcommands/Break.swift +++ b/Sources/sclt/Subcommands/Break.swift @@ -10,7 +10,7 @@ import ArgumentParser import SwiftLI struct BreakCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "break", abstract: "Display of Break structure", discussion: """ diff --git a/Sources/sclt/Subcommands/Group.swift b/Sources/sclt/Subcommands/Group.swift index dbb418d..21f0ff9 100644 --- a/Sources/sclt/Subcommands/Group.swift +++ b/Sources/sclt/Subcommands/Group.swift @@ -10,7 +10,7 @@ import ArgumentParser import SwiftLI struct GroupCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "group", abstract: "Display of Group structure", discussion: """ diff --git a/Sources/sclt/Subcommands/HDivider.swift b/Sources/sclt/Subcommands/HDivider.swift index af0d974..aadebba 100644 --- a/Sources/sclt/Subcommands/HDivider.swift +++ b/Sources/sclt/Subcommands/HDivider.swift @@ -10,7 +10,7 @@ import ArgumentParser import SwiftLI struct HDividerCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "hdivider", abstract: "Display of HDivider structure", discussion: """ diff --git a/Sources/sclt/Subcommands/Label.swift b/Sources/sclt/Subcommands/Label.swift index 21d8d64..63b66b3 100644 --- a/Sources/sclt/Subcommands/Label.swift +++ b/Sources/sclt/Subcommands/Label.swift @@ -11,7 +11,7 @@ import SwiftLI struct LabelCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "label", abstract: "Display of Label structure", discussion: """ diff --git a/Sources/sclt/Subcommands/Spacer.swift b/Sources/sclt/Subcommands/Spacer.swift index e85d3ac..e0b4282 100644 --- a/Sources/sclt/Subcommands/Spacer.swift +++ b/Sources/sclt/Subcommands/Spacer.swift @@ -10,7 +10,7 @@ import ArgumentParser import SwiftLI struct SpacerCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "spacer", abstract: "Display of HSpacer structure", discussion: """ diff --git a/Sources/sclt/Subcommands/SwiftLogo.swift b/Sources/sclt/Subcommands/SwiftLogo.swift index f4b45b5..d8d49b5 100644 --- a/Sources/sclt/Subcommands/SwiftLogo.swift +++ b/Sources/sclt/Subcommands/SwiftLogo.swift @@ -10,7 +10,7 @@ import ArgumentParser import SwiftLI struct SwiftLogoCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "swift", abstract: "Display of SwiftLogo structure", discussion: """ diff --git a/Sources/sclt/Subcommands/Text.swift b/Sources/sclt/Subcommands/Text.swift index 247a65d..41bc4b1 100644 --- a/Sources/sclt/Subcommands/Text.swift +++ b/Sources/sclt/Subcommands/Text.swift @@ -10,7 +10,7 @@ import ArgumentParser import SwiftLI struct TextCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "text", abstract: "Display of Text structure", discussion: """ diff --git a/Sources/sclt/SwiftLI.swift b/Sources/sclt/SwiftLI.swift index 0d973cb..3bbc60c 100644 --- a/Sources/sclt/SwiftLI.swift +++ b/Sources/sclt/SwiftLI.swift @@ -11,7 +11,7 @@ import ArgumentParser //https://100rabh.medium.com/cli-tool-in-swift-using-swift-argument-parser-subcommands-and-flags-77ee31d9ac99 @main struct scltCommand: ParsableCommand { - static var configuration = CommandConfiguration( + static let configuration = CommandConfiguration( commandName: "sclt", abstract: "Command line tool to check SwiftLI operation", discussion: """ diff --git a/Tests/SwiftLITests/SwiftLITests.swift b/Tests/SwiftLITests/SwiftLITests.swift index e091ae7..cbc1b79 100644 --- a/Tests/SwiftLITests/SwiftLITests.swift +++ b/Tests/SwiftLITests/SwiftLITests.swift @@ -1,3 +1,4 @@ +#if swift(>=6.0) import Testing @testable import SwiftLI import Foundation @@ -86,10 +87,10 @@ struct TextTests { let text3 = Text(header: string, repeating: character, count: int, footer: false) let text4 = Text(header: string, content: string, footer: false) - #expect(text1.content == string) - #expect(text2.content == String(repeating: character, count: int)) - #expect(text3.content == String(repeating: character, count: int)) - #expect(text4.content == string) + #expect(text1.contents == [string]) + #expect(text2.contents == [String(repeating: character, count: int)]) + #expect(text3.contents == [String(repeating: character, count: int)]) + #expect(text4.contents == [string]) } @Test("Is the value of the footer variable correct when initialized?", arguments: [(randomStrings, randomInt, randomCharacter)]) @@ -616,3 +617,4 @@ struct EmoticonTests { } } } +#endif