Swiftpack.co - dduan/IsTTY as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by dduan.
dduan/IsTTY 0.1.0
Helps you decide whether your file is a terminal device.
⭐️ 5
🕓 4 years ago
.package(url: "https://github.com/dduan/IsTTY.git", from: "0.1.0")

IsTTY

Is your file a terminal device (TTY)? This little library provides answers.

API

All API returns a boolean answer!

// For standard file descriptors
IsTTY.standardOutput
IsTTY.standardInput
IsTTY.standardError
// If you don't like the abbreviation:
IsTerminal.standardOutput
IsTerminal.standardInput
IsTerminal.standardError

// Arbitrary file descriptors:
fileIsTTY(descriptor: yourFile)
// Without abbreviation
fileIsTerminal(descriptor: yourFile)

// Foundation is supported:
// Using stdout as example
FileHandle.standardOutput.isTTY
FileHandle.standardOutput.isTerminal
// Works with arbitrary file handle:
myFileHandle.isTTY
myFileHandle.isTerminal

Install

Use SwiftPM.

.package(url: "http://github.com/dduan/IsTTY", from: "0.1.0")

License

MIT.

GitHub

link
Stars: 5
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics