CLI Script Modularity Discussion

Lukas Krejci lkrejci at redhat.com
Thu Mar 22 15:17:45 UTC 2012


Hi,

currently one of the big deficiencies of our CLI (both in the batch mode in the remote CLI client and in the serverside CLI alert scripts) is that there is no way of "importing" scripts into each other, or rather declaring and requiring different modules (in different files) that could then be reused inside the scripts. This forces every script to be a standalone "universe" which is a terrible thing for code reuse.

In javascript land, there has been some attempts at solving this very problem and recently we started thinking about how we could incorporate emerging standards/specifications like CommonJS into our CLI. The advantages are obvious - the users would gain access to a module loading mechanism that would enable code reuse and, depending on whether we decide to include some implementation of CommonJS APIs, a large almost-standardized library of functions to use in their scripts.

I started a wiki page where I listed a couple of options we have with regards to a module loading solution on http://rhq-project.org/display/RHQ/Script+Modularity.

If you have any ideas or opinions on this, please let us know. In my opinion having a modular scripting environment would be a huge win for RHQ which has quite large and chatty remote API which just calls for some simplifying wrappers that would make their usage a more pleasant experience for script writers and being able to build a library of utility modules is a prerequisite for that.

Thanks,

Lukas


More information about the rhq-devel mailing list