mschubert / ebits

R bioinformatics toolkit incubator
Apache License 2.0
6 stars 3 forks source link

In io module, automatically evaluate module_file on given path #92

Open mschubert opened 6 years ago

mschubert commented 6 years ago

This would make sure that read/write is always relative to the script the call resides in.

Any downsides?

klmr commented 6 years ago

The downside is that you sometimes want to use files relative to PWD. In fact, I’d guess that this is the most common use-case for data files, definitely always with user-provided files. Consider:

sys = mod::use(klmr/sys)

sys$run({ 
    io = mod::use(ebits/io)
    args = sys$cmd$parse(arg('file', 'input file'))
    sys$printf('%s', summary(io$read_table(args$file)))
})
mschubert commented 6 years ago

NB: this issue is probably 2 years old, I just copied them from the other repository and they will need to be cleaned up further. We didn't have a sys module back then.

And yes, this is true for command-line interfaces, but usually not for modules providing API access to data. But you're right, the better way to simplify module-relative file access is probably https://github.com/klmr/modules/issues/132