OpenFreeEnergy / openfe

The Open Free Energy toolkit
https://docs.openfree.energy
MIT License
140 stars 20 forks source link

CLI: Allow globs for paths #486

Open richardjgowers opened 1 year ago

richardjgowers commented 1 year ago

the -M (and similar) options should allow multiple files to be passed using *, so -M ligand_*.sdf to grab all ligand files matching that pattern.

Currently gives: Error: Got unexpected extra arguments (10.sdf 11.sdf 12.sdf 13.sdf 14.sdf 15.sdf 16.sdf 17.sdf 18.sdf 19.sdf)

mikemhenry commented 1 year ago

Just to clarify, you want the glob expansion to happen in the cli tool and not in the shell? Or are you saying -M should take a list (I think that is what you mean)

dwhswenson commented 1 year ago

Taking a list is a bad idea. It creates ambiguities with params that don't take flags, which is why this isn't how most tools do that. For example: openfe quickrun -M ligand1.sdf ligand2.sdf transformation.json becomes ambiguous when parsing (how does it know that transformation.json isn't also for the -M?) We could rewrite a click's parser to check and group by file extensions, but that seems like a lot of work.

Using glob within the CLI parameter is reasonable, but I'd like to avoid losing too much of click's validation.

Also, -M can take a directory. Just put the files in a directory.