From 9c5f895fcd2d9d392e521b15b7d583061e989de9 Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Tue, 9 Nov 2021 13:14:59 -0800 Subject: [PATCH] Update swift-argument-parser This also removes support for parsing unknown arguments in `docc convert` --- Package.resolved | 6 +++--- Package.swift | 2 +- .../ArgumentParsing/Subcommands/Convert.swift | 12 ------------ .../ArgumentParsing/ConvertSubcommandTests.swift | 15 --------------- 4 files changed, 4 insertions(+), 31 deletions(-) diff --git a/Package.resolved b/Package.resolved index 75c28917cc..fbc745d6c2 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/apple/swift-argument-parser", "state": { "branch": null, - "revision": "83b23d940471b313427da226196661856f6ba3e0", - "version": "0.4.4" + "revision": "d2930e8fcf9c33162b9fcc1d522bc975e2d4179b", + "version": "1.0.1" } }, { @@ -51,7 +51,7 @@ "repositoryURL": "https://github.com/apple/swift-markdown.git", "state": { "branch": "main", - "revision": "2ba1ed580d18b330f6e89d999b6e09f5f1343fde", + "revision": "9a9050095ec93853c0ed01930a9d108d79dc4776", "version": null } }, diff --git a/Package.swift b/Package.swift index 595bb8d80c..5f944e1150 100644 --- a/Package.swift +++ b/Package.swift @@ -114,7 +114,7 @@ if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { .package(url: "https://github.com/apple/swift-nio-ssl.git", .upToNextMinor(from: "2.15.0")), .package(name: "swift-markdown", url: "https://github.com/apple/swift-markdown.git", .branch("main")), .package(name: "CLMDB", url: "https://github.com/apple/swift-lmdb.git", .branch("main")), - .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "0.4.4")), + .package(url: "https://github.com/apple/swift-argument-parser", .upToNextMinor(from: "1.0.1")), .package(name: "SymbolKit", url: "https://github.com/apple/swift-docc-symbolkit", .branch("main")), .package(url: "https://github.com/apple/swift-crypto.git", .upToNextMinor(from: "1.1.2")), ] diff --git a/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift b/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift index f6a5be1319..273842f15b 100644 --- a/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift +++ b/Sources/SwiftDocCUtilities/ArgumentParsing/Subcommands/Convert.swift @@ -185,14 +185,6 @@ extension Docc { """)) public var diagnosticLevel: String? - // Parse and ignore any unrecognized flags, options, and input. - // - // When we're adding new flags or options to the `convert` command. This behavior allows us to also land - // changes in other tools that pass these values to `docc convert` without coordinating the two releases. - - @Argument(parsing: .unconditionalRemaining, help: .hidden) - var unrecognizedArgumentsAndOptions: [String] = [] - // MARK: - Computed Properties /// The path to the directory that all build output should be placed in. @@ -222,10 +214,6 @@ extension Docc { """) } - if !unrecognizedArgumentsAndOptions.isEmpty { - print("note: The following arguments, options, and flags were not recognized and will be ignored: \(unrecognizedArgumentsAndOptions)") - } - if let outputParent = providedOutputURL?.deletingLastPathComponent() { var isDirectory: ObjCBool = false guard FileManager.default.fileExists(atPath: outputParent.path, isDirectory: &isDirectory), isDirectory.boolValue else { diff --git a/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift b/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift index 0da99f172d..bbc2b6a3b7 100644 --- a/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift +++ b/Tests/SwiftDocCUtilitiesTests/ArgumentParsing/ConvertSubcommandTests.swift @@ -289,21 +289,6 @@ class ConvertSubcommandTests: XCTestCase { } } - func testExtraArgumentsAreIgnored() throws { - setenv(TemplateOption.environmentVariableKey, testTemplateURL.path, 1) - - let convertOptions = try Docc.Convert.parse([ - testBundleURL.path, - // These are unrecognized - "--extra-option", "\"extra value\"", - "--extra-flag", - // This flag is recognized - "--analyze" - ]) - - XCTAssertEqual(convertOptions.unrecognizedArgumentsAndOptions, ["--extra-option", "\"extra value\"", "--extra-flag"]) - } - func testIndex() throws { setenv(TemplateOption.environmentVariableKey, testTemplateURL.path, 1)