Skip to content

Commit 0bd6673

Browse files
gwynneMahdiBM0xTim
authored
Split ConsoleKit into two functional targets (#192)
* Split ConsoleKit into two functional targets - one for terminal interaction, one for command handling, plus an umbrella for compatibility. Also update README, and docs images. Clean up several bits of code. * Apply some of the lessons learned from apple/swift-argument-parser#590, pretty much just for the hell of it. Deprecate `ConsoleErrror`. * Readme cleanup * Make the levenshteinDistance method noticeably more efficient. --------- Co-authored-by: Mahdi Bahrami <github@mahdibm.com> Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
1 parent 2e3e205 commit 0bd6673

File tree

80 files changed

+475
-453
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+475
-453
lines changed

.github/CONTRIBUTING.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/api-docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ jobs:
1010
secrets: inherit
1111
with:
1212
package_name: console-kit
13-
modules: ConsoleKit
14-
pathsToInvalidate: /consolekit/*
13+
modules: ConsoleKit ConsoleKitTerminal ConsoleKitCommands
14+
pathsToInvalidate: /consolekit/* /consolekitterminal/* /consolekitcommands/*

Package.swift

Lines changed: 51 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,34 +11,62 @@ let package = Package(
1111
],
1212
products: [
1313
.library(name: "ConsoleKit", targets: ["ConsoleKit"]),
14+
.library(name: "ConsoleKitTerminal", targets: ["ConsoleKitTerminal"]),
15+
.library(name: "ConsoleKitCommands", targets: ["ConsoleKitCommands"]),
1416
],
1517
dependencies: [
1618
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.3"),
1719
.package(url: "https://github.com/apple/swift-nio.git", from: "2.56.0"),
1820
],
1921
targets: [
20-
.target(name: "ConsoleKit", dependencies: [
21-
.product(name: "Logging", package: "swift-log"),
22-
.product(name: "NIOConcurrencyHelpers", package: "swift-nio")
23-
]),
24-
.testTarget(name: "ConsoleKitTests", dependencies: [
25-
.target(name: "ConsoleKit"),
26-
]),
27-
.testTarget(name: "AsyncConsoleKitTests", dependencies: [
28-
.target(name: "ConsoleKit"),
29-
]),
30-
.testTarget(name: "ConsoleKitPerformanceTests", dependencies: [
31-
.target(name: "ConsoleKit")
32-
]),
33-
.executableTarget(name: "ConsoleKitExample", dependencies: [
34-
.target(name: "ConsoleKit"),
35-
]),
36-
.executableTarget(name: "ConsoleKitAsyncExample", dependencies: [
37-
.target(name: "ConsoleKit")
38-
]),
39-
.executableTarget(name: "ConsoleLoggerExample", dependencies: [
40-
.target(name: "ConsoleKit"),
41-
.product(name: "Logging", package: "swift-log")
42-
])
22+
.target(
23+
name: "ConsoleKit",
24+
dependencies: [
25+
.target(name: "ConsoleKitCommands"),
26+
.target(name: "ConsoleKitTerminal"),
27+
]
28+
),
29+
.target(
30+
name: "ConsoleKitCommands",
31+
dependencies: [
32+
.product(name: "Logging", package: "swift-log"),
33+
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
34+
.target(name: "ConsoleKitTerminal"),
35+
]
36+
),
37+
.target(
38+
name: "ConsoleKitTerminal",
39+
dependencies: [
40+
.product(name: "Logging", package: "swift-log"),
41+
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
42+
]
43+
),
44+
.testTarget(
45+
name: "ConsoleKitTests",
46+
dependencies: [.target(name: "ConsoleKit")]
47+
),
48+
.testTarget(
49+
name: "AsyncConsoleKitTests",
50+
dependencies: [.target(name: "ConsoleKit")]
51+
),
52+
.testTarget(
53+
name: "ConsoleKitPerformanceTests",
54+
dependencies: [.target(name: "ConsoleKit")]
55+
),
56+
.executableTarget(
57+
name: "ConsoleKitExample",
58+
dependencies: [.target(name: "ConsoleKit")]
59+
),
60+
.executableTarget(
61+
name: "ConsoleKitAsyncExample",
62+
dependencies: [.target(name: "ConsoleKit")]
63+
),
64+
.executableTarget(
65+
name: "ConsoleLoggerExample",
66+
dependencies: [
67+
.target(name: "ConsoleKit"),
68+
.product(name: "Logging", package: "swift-log"),
69+
]
70+
),
4371
]
4472
)

Package@swift-5.9.swift

Lines changed: 68 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
// swift-tools-version:5.9
22
import PackageDescription
33

4+
let swiftSettings: [PackageDescription.SwiftSetting] = [
5+
.enableExperimentalFeature("StrictConcurrency=complete"),
6+
.enableUpcomingFeature("ExistentialAny"),
7+
.enableUpcomingFeature("ForwardTrailingClosures"),
8+
.enableUpcomingFeature("ConciseMagicFile"),
9+
.enableUpcomingFeature("DisableOutwardActorInference"),
10+
]
11+
412
let package = Package(
513
name: "console-kit",
614
platforms: [
@@ -11,39 +19,71 @@ let package = Package(
1119
],
1220
products: [
1321
.library(name: "ConsoleKit", targets: ["ConsoleKit"]),
22+
.library(name: "ConsoleKitTerminal", targets: ["ConsoleKitTerminal"]),
23+
.library(name: "ConsoleKitCommands", targets: ["ConsoleKitCommands"]),
1424
],
1525
dependencies: [
1626
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.3"),
1727
.package(url: "https://github.com/apple/swift-nio.git", from: "2.56.0"),
1828
],
1929
targets: [
20-
.target(name: "ConsoleKit", dependencies: [
21-
.product(name: "Logging", package: "swift-log"),
22-
.product(name: "NIOConcurrencyHelpers", package: "swift-nio")
23-
], swiftSettings: [
24-
.enableExperimentalFeature("StrictConcurrency=complete"),
25-
.enableUpcomingFeature("ExistentialAny"),
26-
.enableUpcomingFeature("ForwardTrailingClosures"),
27-
.enableUpcomingFeature("ConciseMagicFile"),
28-
]),
29-
.testTarget(name: "ConsoleKitTests", dependencies: [
30-
.target(name: "ConsoleKit"),
31-
], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]),
32-
.testTarget(name: "AsyncConsoleKitTests", dependencies: [
33-
.target(name: "ConsoleKit"),
34-
], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]),
35-
.testTarget(name: "ConsoleKitPerformanceTests", dependencies: [
36-
.target(name: "ConsoleKit")
37-
], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]),
38-
.executableTarget(name: "ConsoleKitExample", dependencies: [
39-
.target(name: "ConsoleKit"),
40-
], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]),
41-
.executableTarget(name: "ConsoleKitAsyncExample", dependencies: [
42-
.target(name: "ConsoleKit")
43-
], swiftSettings: [.enableExperimentalFeature("StrictConcurrency=complete")]),
44-
.executableTarget(name: "ConsoleLoggerExample", dependencies: [
45-
.target(name: "ConsoleKit"),
46-
.product(name: "Logging", package: "swift-log")
47-
])
30+
.target(
31+
name: "ConsoleKit",
32+
dependencies: [
33+
.target(name: "ConsoleKitCommands"),
34+
.target(name: "ConsoleKitTerminal"),
35+
],
36+
swiftSettings: swiftSettings
37+
),
38+
.target(
39+
name: "ConsoleKitCommands",
40+
dependencies: [
41+
.product(name: "Logging", package: "swift-log"),
42+
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
43+
.target(name: "ConsoleKitTerminal"),
44+
],
45+
swiftSettings: swiftSettings
46+
),
47+
.target(
48+
name: "ConsoleKitTerminal",
49+
dependencies: [
50+
.product(name: "Logging", package: "swift-log"),
51+
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
52+
],
53+
swiftSettings: swiftSettings
54+
),
55+
.testTarget(
56+
name: "ConsoleKitTests",
57+
dependencies: [.target(name: "ConsoleKit")],
58+
swiftSettings: swiftSettings
59+
),
60+
.testTarget(
61+
name: "AsyncConsoleKitTests",
62+
dependencies: [.target(name: "ConsoleKit")],
63+
swiftSettings: swiftSettings
64+
),
65+
.testTarget(
66+
name: "ConsoleKitPerformanceTests",
67+
dependencies: [.target(name: "ConsoleKit")],
68+
swiftSettings: swiftSettings
69+
),
70+
.executableTarget(
71+
name: "ConsoleKitExample",
72+
dependencies: [.target(name: "ConsoleKit")],
73+
swiftSettings: swiftSettings
74+
),
75+
.executableTarget(
76+
name: "ConsoleKitAsyncExample",
77+
dependencies: [.target(name: "ConsoleKit")],
78+
swiftSettings: swiftSettings
79+
),
80+
.executableTarget(
81+
name: "ConsoleLoggerExample",
82+
dependencies: [
83+
.target(name: "ConsoleKit"),
84+
.product(name: "Logging", package: "swift-log"),
85+
],
86+
swiftSettings: swiftSettings
87+
),
4888
]
4989
)

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<p align="center">
22
<picture>
3-
<source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/1130717/261745577-198fc7fb-5d7c-4702-ae46-f7abbcadf2a0.png">
4-
<source media="(prefers-color-scheme: light)" srcset="https://user-images.githubusercontent.com/1130717/261745583-90f95eb5-fe6f-4e1b-8fe1-268ff889199d.png">
5-
<img src="https://user-images.githubusercontent.com/1130717/261745583-90f95eb5-fe6f-4e1b-8fe1-268ff889199d.png" height="96" alt="ConsoleKit">
3+
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/vapor/console-kit/assets/1130717/3c06f3a4-8edb-4341-8b50-eb6aacb47e0b">
4+
<source media="(prefers-color-scheme: light)" srcset="https://github.com/vapor/console-kit/assets/1130717/3bb2255d-f564-43d2-a9e9-386420005adf">
5+
<img src="https://github.com/vapor/console-kit/assets/1130717/3bb2255d-f564-43d2-a9e9-386420005adf" height="96" alt="ConsoleKit">
66
</picture>
77
<br>
88
<br>
9-
<a href="https://docs.vapor.codes/4.0/"><img src="https://img.shields.io/badge/read_the-docs-2196f3.svg" alt="Documentation"></a>
10-
<a href="https://discord.gg/vapor"><img src="https://img.shields.io/discord/431917998102675485.svg" alt="Team Chat"></a>
11-
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT License"></a>
12-
<a href="https://github.com/vapor/console-kit/actions/workflows/test.yml"><img src="https://github.com/vapor/console-kit/actions/workflows/test.yml/badge.svg" alt="Continuous Integration"></a>
13-
<a href="https://swift.org"><img src="https://img.shields.io/badge/swift-5.6-brightgreen.svg" alt="Swift 5.6"></a>
9+
<a href="https://docs.vapor.codes/4.0/"><img src="https://design.vapor.codes/images/readthedocs.svg" alt="Documentation"></a>
10+
<a href="https://discord.gg/vapor"><img src="https://design.vapor.codes/images/discordchat.svg" alt="Team Chat"></a>
11+
<a href="LICENSE"><img src="https://design.vapor.codes/images/mitlicense.svg" alt="MIT License"></a>
12+
<a href="https://github.com/vapor/console-kit/actions/workflows/test.yml"><img src="https://img.shields.io/github/actions/workflow/status/vapor/console-kit/test.yml?event=push&style=plastic&logo=github&label=test&logoColor=%23ccc" alt="Continuous Integration"></a>
13+
<a href="https://codecov.io/gh/vapor/console-kit"><img src="https://img.shields.io/codecov/c/gh/vapor/console-kit?style=plastic&logo=codecov&label=Codecov&token=FroD9hgbSC"></a>
14+
<a href="https://swift.org"><img src="https://design.vapor.codes/images/swift57up.svg" alt="Swift 5.7+"></a>
1415
</p>
1516
<br>

Sources/ConsoleKit/Command/Utilities.swift

Lines changed: 0 additions & 47 deletions
This file was deleted.

Sources/ConsoleKit/Docs.docc/images/article.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 17 additions & 36 deletions
Loading

Sources/ConsoleKit/Docs.docc/index.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
@TitleHeading(Package)
55
}
66

7-
ConsoleKit provides utilities for interacting with a console via a Swift application. It provides:
7+
Utilities for interacting with a terminal and the commandline in a Swift application.
88

9-
* A ``Command`` type for writing commands with arguments and flags
10-
* Utilities for sending and receiving text to a terminal
11-
* A [Swift Log](https://github.com/apple/swift-log) implementation for a ``Logger`` that outputs to the console
12-
13-
> Note: At this time, the argument handling capabilities of ConsoleKit are considered obsolete; using [ArgumentParser](https://github.com/apple/swift-argument-parser.git) instead is recommended where practical.
9+
`ConsoleKit` is an umbrella module, exporting [ConsoleKitTerminal](./ConsoleKitTerminal) and [ConsoleKitCommands](./ConsoleKitCommands). It has no separate functionality of its own.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy