It should be simpler to support piping input
4th
February 2025
Appreciate this issues is very old but here’s my solution for what it’s worth. I’m sure one could do the same for
FileHandle
andInputStream
. One concern is the@retroactive
keyword but I suspect that would go away if the code was folded into this project repo.extension Data: @retroactive ExpressibleByArgument { public init?(argument: String) { if argument == "-" { self = FileHandle.standardInput.availableData } else if let url = URL(string: argument), let data = try? Data(contentsOf: url) { self = data } else if let data = try? Data(contentsOf: URL(fileURLWithPath: argument)) { self = data } else { return nil } } }