Created
December 16, 2020 17:26
-
-
Save xrrocha/e4ae4dc43e89715437645831f084f067 to your computer and use it in GitHub Desktop.
code block for README-5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Collect readers from args/stdin | |
val readers = | |
if (args.isNotEmpty()) | |
args.map { File(it).reader() } | |
else | |
listOf(System.`in`.reader()) | |
// Swallow all readers into one string | |
val content = | |
readers.joinToString("\n") { | |
// Read all file as a string | |
it.readText() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment