I write a lot of scripts in Mathematica and I'd like to eliminate the boilerplate that parses command-line arguments and assigns them to variables of the correct type before doing the real work. I was thinking of accomplishing the following way.
Find a function called
Look at the list of its parameters
[a_Integer, b_Real, c_String].
Attempt to convert the elements of $ScriptCommandLine into those parameters.
Call main with those parameters.
This way, each script can simply contain a function main that will be called with the appropriate parameters from a bootstrap script.
I'm trying to figure out how to accomplish #2. I've been trying to use
Definition, but I can't figure out how to parse the output. Is there a better way?