Skip to content

Commit 4ffbd95

Browse files
committed
adapted for ArgParser technique
1 parent c406a8f commit 4ffbd95

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

Sources/Commands/SwiftTool.swift

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -354,34 +354,35 @@ public class SwiftTool {
354354
verbosity = Verbosity(rawValue: options.verbosity)
355355
Process.verbose = verbosity != .concise
356356
}
357-
357+
358358
static func postprocessArgParserResult(options: SwiftToolOptions, diagnostics: DiagnosticsEngine) throws {
359359
if options.chdir != nil {
360360
diagnostics.emit(warning: "'--chdir/-C' option is deprecated; use '--package-path' instead")
361361
}
362-
362+
363363
if options.multirootPackageDataFile != nil {
364364
diagnostics.emit(.unsupportedFlag("--multiroot-data-file"))
365365
}
366-
366+
367367
if options.useExplicitModuleBuild && !options.useIntegratedSwiftDriver {
368368
diagnostics.emit(error: "'--experimental-explicit-module-build' option requires '--use-integrated-swift-driver'")
369369
}
370-
370+
371371
if !options.archs.isEmpty && options.customCompileTriple != nil {
372372
diagnostics.emit(.mutuallyExclusiveArgumentsError(arguments: ["--arch", "--triple"]))
373373
}
374-
374+
375375
if options.netrcFilePath != nil {
376-
// --netrc-file option only supported on macOS >=10.13
377-
#if os(macOS)
378-
if #available(macOS 10.13, *) {
379-
// ok, check succeeds
380-
} else {
376+
// --netrc-file option only supported on macOS >=10.13
377+
#if os(macOS)
378+
if #available(macOS 10.13, *) {
379+
// ok, check succeeds
380+
} else {
381381
diagnostics.emit(error: "--netrc-file option is only supported on macOS >=10.13")
382-
}
383-
#else
384-
diagnostics.emit(error: "--netrc-file option is only supported on macOS >=10.13")
382+
}
383+
#else
384+
diagnostics.emit(error: "--netrc-file option is only supported on macOS >=10.13")
385+
#endif
385386
}
386387
}
387388

Tests/CommandsTests/PackageToolTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ final class PackageToolTests: XCTestCase {
5555
#if os(macOS)
5656
if #available(macOS 10.13, *) {
5757
// should succeed
58-
XCTAssert(try execute(["--netrc-file", "/Users/me/.hidden/.netrc"]).stdout.contains("Absolute path to netrc file"))
58+
XCTAssert(try execute(["--netrc-file", "/Users/me/.hidden/.netrc"]).stdout.contains("USAGE: swift package"))
5959
} else {
6060
verifyUnsupportedOSThrows()
6161
}

0 commit comments

Comments
 (0)