while True:
    astr = input('$: ')
try:
    args = parser.parse_args(astr.split())
except SystemExit:
    print('error')
continue
if args.cmd in ['create', 'delete']:
    print('doing', args.cmd)
elif args.cmd == 'help':
    parser.print_help()
else:
    print('done')
break
Make my python command line program interactive with argparse