Add utility to call func using command line opts

Use the function's signature to extract arguments from the command line
options and parameters, and call the function.