amitt001 / delegator.py

Subprocesses for Humans 2.0.
MIT License
1.7k stars 92 forks source link

run: add command_cls arg to allow for custom Command class #48

Closed azban closed 3 years ago

azban commented 6 years ago

i want to use this library, but would like to make some modifications to Command that may not be for everyone. this seems like a fair way to allow for that without having to monkey patch.

azban commented 6 years ago

thoughts?

timofurrer commented 5 years ago

The delegator.run() function is pretty small.

Is there a particular reason why you want to use it like that and not just create your own function?

def my_run(...):
    cmd = YourCommand(....)
    cmd.run(...)
    return cmd
azban commented 5 years ago

that's an option.. this just seemed benign and i figured it would be nicer to hook into existing implementation rather than copying and potentially diverging in the future.

in my case, i have a few different command classes which i want to run with, but i don't think that really changes anything (i.e. could just have multiple wrapper functions as you mentioned)