 		case missingValueForToken(String)
 	}
 	
-	public let machines: [NetrcMachine]
+	public let machines: [Machine]
 	
-	init(machines: [NetrcMachine]) {
+	init(machines: [Machine]) {
 		self.machines = machines
 	}
 	

		return "Basic \(authData.base64EncodedString())"
	}
	
    public static func load(from fileURL: Foundation.URL = Foundation.URL(fileURLWithPath: "\(NSHomeDirectory())/.netrc")) -> Result<Netrc, NetrcError> {
		guard FileManager.default.fileExists(atPath: fileURL.path) else { return .failure(NetrcError.fileNotFound(fileURL)) }
		guard FileManager.default.isReadableFile(atPath: fileURL.path),
            let fileContents = try? String(contentsOf: fileURL, encoding: .utf8) else { return .failure(NetrcError.unreadableFile(fileURL)) }
		
        return Netrc.from(fileContents)
	}
	
    public static func from(_ content: String) -> Result<Netrc, NetrcError> {
		let trimmedCommentsContent = trimComments(from: content)
		let tokens = trimmedCommentsContent
			.trimmingCharacters(in: .whitespacesAndNewlines)
			.components(separatedBy: .whitespacesAndNewlines)
			.filter({ $0 != "" })
		
		var machines: [NetrcMachine] = []
		
		let machineTokens = tokens.split { $0 == "machine" }
		guard tokens.contains("machine"), machineTokens.count > 0 else { return .failure(NetrcError.machineNotFound) }
		
		for machine in machineTokens {
			let values = Array(machine)
			guard let name = values.first else { continue }
			guard let login = values["login"] else { return .failure(NetrcError.missingValueForToken("login")) }
			guard let password = values["password"] else { return .failure(NetrcError.missingValueForToken("password")) }
			machines.append(NetrcMachine(name: name, login: login, password: password))
		}
		
		guard machines.count > 0 else { return .failure(NetrcError.machineNotFound) }
		return .success(Netrc(machines: machines))
	}
	

import Foundation


public struct Netrc {
    
    public struct Machine {
        public let name: String
        public let login: String
        public let password: String
    }
	
    public enum Error: Swift.Error {
        case fileNotFound(Foundation.URL)
        case unreadableFile(Foundation.URL)
		case machineNotFound
