Last active
May 25, 2024 10:18
-
-
Save dacr/8f9abbe43017866c1ae9ecf88a530b7f to your computer and use it in GitHub Desktop.
com-lihaoyi pprint basic usage examples / published by https://github.com/dacr/code-examples-manager #e3195c2d-66f5-403d-9332-cf907e34db04/4f1db5f6a97f7f5496c7aa6c6a4453a4cefab585
This file contains hidden or 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
// summary : com-lihaoyi pprint basic usage examples | |
// keywords : scala, lihaoyi, pprint, @testable | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : e3195c2d-66f5-403d-9332-cf907e34db04 | |
// created-on : 2024-01-06T12:25:07+01:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// --------------------- | |
//> using scala "3.4.2" | |
//> using dep "com.lihaoyi::os-lib:0.9.3" | |
// --------------------- | |
val wd = os.pwd / "com-lihaoyi-os-lib-working-directory" | |
os.remove.all(wd) | |
os.makeDir.all(wd) | |
val file = wd / "file.txt" | |
val fileCopy = wd / "copied.txt" | |
os.write(file, "hello") | |
os.read(file) | |
os.copy(file, fileCopy) | |
assert(os.list(wd).size == 2) | |
val result = os.proc("cat", file, fileCopy).call(wd) | |
assert(result.out.trim() == "hellohello") | |
os.remove.all(wd) | |
assert(os.exists(wd) == false) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment