File tree Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Expand file tree Collapse file tree 2 files changed +10
-20
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,8 @@ public struct SwiftToolOptions: ParsableArguments {
320
320
var netrc : Bool = true
321
321
322
322
/// Similar to `--netrc`, but this option makes the .netrc usage optional and not mandatory as with the `--netrc` option.
323
- @Flag ( name: . customLong( " netrc-optional " ) )
323
+ @available ( * , deprecated, message: " .netrc files are located by default " )
324
+ @Flag ( name: . customLong( " netrc-optional " ) , help: . hidden)
324
325
var netrcOptional : Bool = false
325
326
326
327
/// The path to the netrc file which should be use for authentication when downloading binary target artifacts.
Original file line number Diff line number Diff line change @@ -485,27 +485,16 @@ public class SwiftTool {
485
485
return try self . getNetrcConfig ( ) ? . get ( )
486
486
}
487
487
488
- func getNetrcConfig( ) throws -> Workspace . Configuration . Netrc ? {
489
- guard options. netrc || options. netrcFilePath != nil || options. netrcOptional else {
490
- return . none
491
- }
488
+ func getNetrcConfig( ) -> Workspace . Configuration . Netrc ? {
489
+ guard options. netrc else { return nil }
492
490
493
- let netrcFilePath = try self . netrcFilePath ( )
494
- return netrcFilePath. map { . init( path: $0, fileSystem: localFileSystem) }
495
- }
496
-
497
- private func netrcFilePath( ) throws -> AbsolutePath ? {
498
- let netrcFilePath = options. netrcFilePath ?? localFileSystem. homeDirectory. appending ( component: " .netrc " )
499
- guard localFileSystem. exists ( netrcFilePath) else {
500
- if !options. netrcOptional {
501
- ObservabilitySystem . topScope. emit ( error: " Cannot find mandatory .netrc file at \( netrcFilePath) . To make .netrc file optional, use --netrc-optional flag. " )
502
- throw ExitCode . failure
503
- } else {
504
- ObservabilitySystem . topScope. emit ( warning: " Did not find optional .netrc file at \( netrcFilePath) . " )
505
- return . none
506
- }
491
+ let path = options. netrcFilePath ?? localFileSystem. homeDirectory. appending ( component: " .netrc " )
492
+ guard localFileSystem. exists ( path) else {
493
+ ObservabilitySystem . topScope. emit ( warning: " Did not find .netrc file at \( path) . " )
494
+ return nil
507
495
}
508
- return netrcFilePath
496
+
497
+ return . init( path: path, fileSystem: localFileSystem)
509
498
}
510
499
511
500
private func getSharedCacheDirectory( ) throws -> AbsolutePath ? {
You can’t perform that action at this time.
0 commit comments