Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dduan/istty
Helps you decide whether your file is a terminal device.
https://github.com/dduan/istty
Last synced: 29 days ago
JSON representation
Helps you decide whether your file is a terminal device.
- Host: GitHub
- URL: https://github.com/dduan/istty
- Owner: dduan
- License: mit
- Created: 2019-09-15T20:19:37.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2019-09-15T20:24:45.000Z (about 5 years ago)
- Last Synced: 2024-08-10T14:18:33.540Z (3 months ago)
- Language: Swift
- Size: 1000 Bytes
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# IsTTY
Is your file a terminal device (TTY)? This little library provides answers.
## API
All API returns a boolean answer!
```swift
// 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.
```swift
.package(url: "http://github.com/dduan/IsTTY", from: "0.1.0")
```## License
MIT.