in reply to Need feedback on a wrapper script design.

This is a very labor-intensive solution to the arguments problem, but here goes.

Edit each of the scripts to respond to a set input. For instance "mytool -h" might return a specification of the arguments that the tool accepts and perhaps a description of their effects that you could parse automatically. Perhaps you could use xml. You would want to look out for optional inputs, required inputs, modes, etc.

Since it sounds like you have a lot of existing scripts, you might want to just write a quick perl wrapper for each of the existing tools that could return this description if called with no arguments, or runs the intended tool with whatever arguments are supplied. New scripts that you write could then support this self-specification protocol and do away with the wrapper. Just point your program at the directory of wrappers and it would be able to automatically determine what sort of arguments each tool needs.

Using this method, you wouldn't need some sort of database that would need to be maintained seperately, the tool itself (or its wrapper) would advertise its interface.
  • Comment on Re: Need feedback on a wrapper script design.

Replies are listed 'Best First'.
Re^2: Need feedback on a wrapper script design.
by sauoq (Abbot) on Sep 25, 2005 at 00:11 UTC
    Edit each of the scripts to respond to a set input.

    IMHO, this is poor advice. Changing the interface of a bunch of existing tools which are, presumably, in regular use is a very bad idea.

    -sauoq
    "My two cents aren't worth a dime.";