Skip to content

Commit

Permalink
feat: add support for reading from stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
socsieng committed Dec 30, 2020
1 parent c7c7621 commit 463d777
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Sources/SendKeysLib/SendKeysCli.swift
Expand Up @@ -50,6 +50,14 @@ public struct SendKeysCli: ParsableCommand {

if !(commandString ?? "").isEmpty {
commandProcessor.process(commandString!)
} else {
var data: Data

repeat {
data = FileHandle.standardInput.availableData
commandString = String(data: data, encoding: .utf8)
commandProcessor.process(commandString!)
} while data.count > 0
}
}
}

0 comments on commit 463d777

Please sign in to comment.