change from optparse to argparse, add cli tests