apis_lib function for generating commandline from opts hash