Skip to content

Commit 5a94f3c

Browse files
authored
work around argument parser usage synopsis issue (#4194)
motivation: When invoking any unknown or help-triggering `swift package` command in terminal, the suggested invocation always includes the `--enable-dependency-cache` flag. changes: useDependenciesCache flag to be non-optional, since this triggres a bug in argument parser which adds the option to the usage synopsis note: underlying issue fixed in apple/swift-argument-parser#416 rdar://89488586
1 parent 7bdf134 commit 5a94f3c

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Sources/Commands/Options.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ struct LocationOptions: ParsableArguments {
7979
struct CachingOptions: ParsableArguments {
8080
/// Disables package caching.
8181
@Flag(name: .customLong("dependency-cache"), inversion: .prefixedEnableDisable, help: "Use a shared cache when fetching dependencies")
82-
var _useDependenciesCache: Bool?
82+
var _useDependenciesCache: Bool = true
8383

8484
// TODO: simplify when deprecating the older flag
8585
var useDependenciesCache: Bool {
86-
if let value = self._useDependenciesCache {
86+
if let value = self._deprecated_useRepositoriesCache {
8787
return value
88-
} else if let value = self._deprecated_useRepositoriesCache {
89-
return value
90-
} else {
91-
return true
88+
} else {
89+
return self._useDependenciesCache
9290
}
9391
}
9492

0 commit comments

Comments
 (0)