danlabici / taskcluster-worker-checker

Script to check if any releng worker is missing in TC
1 stars 9 forks source link

Trying to fix the previous PR. (menu.py) #90

Closed raduiman-zz closed 6 years ago

raduiman-zz commented 6 years ago

Add the new menu.py to fix the issue reported by Travis with the first PR.

raduiman-zz commented 6 years ago

To answer to Bogdan suggestion of using switch:case instead of if-elif: -as I know Python does not have a switch statement like Java, C, C++ -I've created this method using "if-elif-else" block with the same behavior like "switch:case" statement.

Please let me know if I'm wrong.

raduiman-zz commented 6 years ago

To increase the efficiency of this script we have to find a way to jump at the final of the if-elif-else block after a condition is accomplished. e.g if the option is '1', the first case is fulfilled and then the script is going further and check all the cases. It should exit from the 'if-elif' block and ask for another option.

danlabici commented 6 years ago

Maybe an option would be going with a

while True: do something

And then, when you accomplish what you are looking for, change the flag to False and if it's false, make it jump to the end. Or you could use Cases https://jaxenter.com/implement-switch-case-statement-python-138315.html