fgeorges / mlproj-core

Core implementation of mlproj, everything not TUI-related
Apache License 2.0
1 stars 2 forks source link

Run commands as hooks #15

Open eurochriskelly opened 7 years ago

eurochriskelly commented 7 years ago

There are certain commands that one would like to run before and/or after other commands. It would be nice if one could define a custom command and have it run automatically as a "post-" or "pre-" command hook.

e.g.

hooks: [{
    on: ['deploy', 'watch'],
    before: [ 'clearTDE' ],
    after: [ 'loadTDE' ]
}],
commands: {
    clearTDE: () => { /** clear templates **/ },
    loadTDE: () => { /** load templates**/ }
}

It would still be useful to keep the commands as they are since one sometimes needs to just run the command.

fgeorges commented 7 years ago

Sounds like a good idea in the general case. In this one though:

:-)

eurochriskelly commented 7 years ago

Yeah, I can share those. I made a separate suggestion about plugins before reading this where I also used tde as an example :)