def _parse_command(self, args=None, final=False): """ 解析命令行参数,解析logger配置 :return: """ self._define() add_parse_callback(self._parse_logger_callback) parse_command_line(args, final) options.run_parse_callbacks()
def parse_command(self, args=None, final=False): """ 解析命令行参数,解析logger配置 :return: """ self.define() add_parse_callback(self.parse_logger_callback) parse_command_line(args, final) options.run_parse_callbacks()
def parse_environment_variables(self, options, final=True): """ Parse environment variables to set different configuration values. """ for name in options: env = os.getenv(name.replace('-', '_').upper()) if env is not None: options._options[options._normalize_name(name)].parse(env) if final: options.run_parse_callbacks()
def parse_command(self, args=None, final=False): """ 解析命令行参数,解析logger配置 :return: """ self.define() #在添加parse_command_line执行完成后的回调函数 add_parse_callback(self.parse_logger_callback) parse_command_line(args, final) #执行用add_parse_callback注册的回调函数parse_logger_callback options.run_parse_callbacks()