(self, uargv, temp_dir)
return args
Retrieve command line and option file options.
Retrieve command line and option file options.
Retrieve command line and option file options .
def retrieve_options(self, uargv, temp_dir):
        """Retrieve command line and option file options."""
        # convert command line arguments to string dictionary form
        remaining = self._get_arguments_dict(uargv)
        # unpack any packages
        package = self._parse_package_arg_and_unpack(remaining, temp_dir)
        # get preset groups from specified config file
        preset_dict = self._parse_config_arg_and_process_config_file(remaining)
        # parse default presets nested in config presets
        preset_dict = {
            _key: self._merge_arguments(
                self._parse_presets(_dict, PRESETS),
                _dict
            )
            for _key, _dict in iteritems(preset_dict)
        }
        # set defaults based on presets
        args = self._parse_presets(remaining, preset_dict)
        # local config file settings override preset settings
        self._merge_arguments(args, preset_dict[u'pcbasic'])
        # find unrecognised arguments
        unrecognised = ((_k, _v) for _k, _v in iteritems(args) if _k not in ARGUMENTS)
        for key, value in unrecognised:
            logging.warning(
                'Ignored unrecognised option `%s=%s` in configuration file', key, value
            )
        args = {_k: _v for _k, _v in iteritems(args) if _k in ARGUMENTS}
        # parse rest of command line args
        cmd_line_args = self._parse_args(remaining)
        # command-line args override config file settings
        self._merge_arguments(args, cmd_line_args)
        # parse GW-BASIC style options
        self._parse_gw_options(args)
        # clean up arguments
        self._convert_types(args)
        if package:
            # do not resume from a package
            args['resume'] = False
        return args
def retrieve_options ( self , uargv , temp_dir ) : # convert command line arguments to string dictionary form remaining = self . _get_arguments_dict ( uargv ) # unpack any packages package = self . _parse_package_arg_and_unpack ( remaining , temp_dir ) # get preset groups from specified config file preset_dict = self . _parse_config_arg_and_process_config_file ( remaining ) # parse default presets nested in config presets preset_dict = { _key : self . _merge_arguments ( self . _parse_presets ( _dict , PRESETS ) , _dict ) for _key , _dict in iteritems ( preset_dict ) } # set defaults based on presets args = self . _parse_presets ( remaining , preset_dict ) # local config file settings override preset settings self . _merge_arguments ( args , preset_dict [ u'pcbasic' ] ) # find unrecognised arguments unrecognised = ( ( _k , _v ) for _k , _v in iteritems ( args ) if _k not in ARGUMENTS ) for key , value in unrecognised : logging . warning ( 'Ignored unrecognised option `%s=%s` in configuration file' , key , value ) args = { _k : _v for _k , _v in iteritems ( args ) if _k in ARGUMENTS } # parse rest of command line args cmd_line_args = self . _parse_args ( remaining ) # command-line args override config file settings self . _merge_arguments ( args , cmd_line_args ) # parse GW-BASIC style options self . _parse_gw_options ( args ) # clean up arguments self . _convert_types ( args ) if package : # do not resume from a package args [ 'resume' ] = False return args