Last active
February 3, 2026 20:26
-
-
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/f2ab2a2236c2d7e934da9ec9955f5e72321fb1eb
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 License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // 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