ISISComputingGroup / lewis-ess

Let's write intricate simulators!
GNU General Public License v3.0
21 stars 19 forks source link

Adapters should not parse command line arguments #209

Closed MichaelWedel closed 7 years ago

MichaelWedel commented 7 years ago

This is similar to #207. Currently, raw command line arguments have to be passed to an adapter to configure it. It is perfectly clear that adapters need to be configured somehow and that the command line is used for that.

But when trying to use adapters (or anything that involves them) in another context (#126, #199), the only way to do that is to emulate command line arguments to configure them (or be happy with the default configuration, which is probably almost never the case), which seems a bit convoluted.

Instead of parsing the command line arguments themselves, each adapter should (optionally) define an ArgumentParser that can be used for example by run.py if necessary. Otherwise configuration should happen via a dictionary or a **kwargs-based method or something similar.