We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why you don't use argparse for parsing arguments? It's far more easier to use, code and works as standards. Example below
parser = argparse.ArgumentParser() parser.add_argument("-a", "--addAlarm", action='store_true', required=False, help="Adds given alarm") parser.add_argument("-d", "--deleteAlarm", action='store_true', required=False, help="Removes alarm") parser.add_argument("-c", "--checkAlarms", action='store_true', required=False, help="Check all alarms") parser.add_argument("-p", "--printAlarms", action='store_true', required=False, help="Print all alarms") parser.add_argument("-n", "--stockCode", type=str, required=False, help="") parser.add_argument("-r", "--referencePrice", type=float, required=False, help="") parser.add_argument("-t", "--type", type=str, required=False, help="") parser.add_argument("-v", "--value", type=float, required=False, help="") parser.add_argument("-W", "--lastWeek", action='store_true', required=False, help="Last Week") args = parser.parse_args() #Assert if (not args.addAlarm and not args.checkAlarms and not args.deleteAlarm and not args.printAlarms): print "Missing event" sys.exit(1) if (args.addAlarm): if (not args.stockCode or not args.referencePrice or not args.type or not args.value): print "Missing arguments for adding." sys.exit(1) if (args.deleteAlarm): if (not args.stockCode or not args.referencePrice or not args.type or not args.value): print "Missing arguments for removal." sys.exit(1)`
The text was updated successfully, but these errors were encountered:
Having worked with argparse in the last few months, I agree. Might sit down to code it.
Sorry, something went wrong.
eantoranz
No branches or pull requests
Why you don't use argparse for parsing arguments? It's far more easier to use, code and works as standards. Example below
The text was updated successfully, but these errors were encountered: