cmd = '{0} {1}'.format(kwargs['program'], ' '.join(kwargs['infiles']))
r = envoy.run(cmd)
print(r.std_out)
print(r.std_err)
if __name__ == '__main__':
    parser = argparse.ArgumentParser(description=
        'Get a program and run it with input', version='%(prog)s 1.0')
parser.add_argument('program', type=str, help='Program name')
parser.add_argument('infiles', nargs='+', type=str, help='Input text files')
parser.add_argument('--out', type=str, default='temp.txt', help=
    'name of output file')
args = parser.parse_args()
main(**vars(args))
Python command line parameters