Command Line 활용하기
Python3 에서 sys.argv 를 사용하여 Command별 분기처리하기
sys.argv 사용하기
Command 분기하기
if __name__ == "__main__":
command_executors = {
'validate': command_validate,
'test': command_test,
'help': command_help
}
command = command_executors.get(sys.argv[1])
try:
command()
sys.exit(0)
except Exception as e:
logger.error('error=%s\nTraceback:%s' % (str(e), traceback.format_exc()))
sys.exit(1)
Last updated
Was this helpful?