A pony library that just reads files.
- reads files
- prints out an error if it can't
- calls a function on success
- any default behavior (create an empty file, etc.)
- wildcards
- advanced things
- anything fancy
Add it using corral:
corral add github.com/adri326/pony-justreadit.git
corral update
Alternatively, you can just clone this repository and add ./pony-justreadit
(or whichever folder you put it in) to ponyc
's --path
argument.
Once you have installed it, you can include it in your code:
use "justreadit"
actor Main
let env: Env
new create(env': Env) =>
env = env'
JustRead("file.txt", env, this~print_reverse())
fun print_reverse(str: String) =>
env.out.print(str.reverse())
JustRead
will call whichever function you give it as third argument with the read string. You may give it a lambda too.
Remove it from corral's dependencies:
corral remove github.com/adri326/pony-justreadit.git
corral clean # Optional
Remove any use "justreadit"
in your code and replace the ugly JustRead
s with your preffered method of loading files.
Post issues and pull request to this repository!