Skip to content

Commit 07da205

Browse files
authored
Rename main.swift to MarkdownCommand.swift and add @main (#10)
* Rename main.swift to MarkdownCommand.swift and add @main * Update swift-tool-version to 5.5 * Update README.md
1 parent f631ea6 commit 07da205

File tree

4 files changed

+20
-81
lines changed

4 files changed

+20
-81
lines changed

Package.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
// swift-tools-version:5.3
2-
// In order to support users running on the latest Xcodes, please ensure that
3-
// [email protected] is kept in sync with this file.
1+
// swift-tools-version:5.5
42
/*
53
This source file is part of the Swift.org open source project
64

7-
Copyright (c) 2021 Apple Inc. and the Swift project authors
5+
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
86
Licensed under Apache License v2.0 with Runtime Library Exception
97

108
See https://swift.org/LICENSE.txt for license information
@@ -51,9 +49,16 @@ let package = Package(
5149
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
5250
// Building standalone, so fetch all dependencies remotely.
5351
package.dependencies += [
54-
.package(url: "https://github.com/apple/swift-cmark.git", .branch("gfm")),
55-
.package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.0.1")),
52+
.package(url: "https://github.com/apple/swift-cmark.git", branch: "gfm"),
53+
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.2"),
5654
]
55+
56+
// SwiftPM command plugins are only supported by Swift version 5.6 and later.
57+
#if swift(>=5.6)
58+
package.dependencies += [
59+
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.1.0"),
60+
]
61+
#endif
5762
} else {
5863
// Building in the Swift.org CI system, so rely on local versions of dependencies.
5964
package.dependencies += [

[email protected]

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

README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,18 @@ The markup tree provided by this package is comprised of immutable/persistent, t
1111
In your `Package.swift` Swift Package Manager manifest, add the following dependency to your `dependencies` argument:
1212

1313
```swift
14-
.package(url: "https://github.com/apple/swift-markdown.git", .branch("main")),
14+
.package(url: "https://github.com/apple/swift-markdown.git", branch: "main"),
1515
```
1616

1717
Add the dependency to any targets you've declared in your manifest:
1818

1919
```swift
20-
.target(name: "MyTarget", dependencies: ["Markdown"]),
20+
.target(
21+
name: "MyTarget",
22+
dependencies: [
23+
.product(name: "Markdown", package: "swift-markdown"),
24+
]
25+
),
2126
```
2227

2328
To parse a document, use `Document(parsing:)`, supplying a `String` or `URL`:
@@ -61,4 +66,4 @@ Swift Markdown can be improved to better meet your needs.
6166

6267
Please see the [contributing guide](https://swift.org/contributing/#contributing-code) for more information.
6368

64-
<!-- Copyright (c) 2021-2022 Apple Inc and the Swift Project authors. All Rights Reserved. -->
69+
<!-- Copyright (c) 2021-2023 Apple Inc and the Swift Project authors. All Rights Reserved. -->

Sources/markdown-tool/main.swift renamed to Sources/markdown-tool/MarkdownCommand.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import ArgumentParser
1212
import Foundation
1313
import Markdown
1414

15+
@main
1516
struct MarkdownCommand: ParsableCommand {
1617
enum Error: LocalizedError {
1718
case couldntDecodeInputAsUTF8
@@ -50,5 +51,3 @@ struct MarkdownCommand: ParsableCommand {
5051
return (stdinString, Document(parsing: stdinString, options: options))
5152
}
5253
}
53-
54-
MarkdownCommand.main()

0 commit comments

Comments
 (0)