Package pyanaconda :: Module anaconda_optparse :: Class AnacondaOptionParser
[hide private]
[frames] | no frames]

Class AnacondaOptionParser

source code

optparse.OptionContainer --+    
                           |    
       optparse.OptionParser --+
                               |
                              AnacondaOptionParser


Subclass of OptionParser that also examines boot arguments.

If the "bootarg_prefix" keyword argument is set, it's assumed that all
bootargs will start with that prefix.

"require_prefix" is a bool:
    False: accept the argument with or without the prefix.
    True: ignore the argument without the prefix. (default)

Instance Methods [hide private]
 
__init__(self, *args, **kwargs) source code
 
add_option(self, *args, **kwargs)
Add a new option - like OptionParser.add_option.
source code
 
_get_bootarg_option(self, arg)
Find the correct Option for a given bootarg (if one exists)
source code
 
parse_boot_cmdline(self, cmdline, values=None)
Parse the boot cmdline and set appropriate values according to the options set by add_option.
source code
 
parse_args(self, args=None, values=None, cmdline=None)
Like OptionParser.parse_args(), but also parses the boot cmdline.
source code

Inherited from optparse.OptionParser: add_option_group, check_values, destroy, disable_interspersed_args, enable_interspersed_args, error, exit, expand_prog_name, format_epilog, format_help, format_option_help, get_default_values, get_description, get_option_group, get_prog_name, get_usage, get_version, print_help, print_usage, print_version, set_default, set_defaults, set_process_default_values, set_usage

Inherited from optparse.OptionParser (private): _add_help_option, _add_version_option, _create_option_list, _get_all_options, _get_args, _get_encoding, _init_parsing_state, _match_long_opt, _populate_option_list, _process_args, _process_long_opt, _process_short_opts

Inherited from optparse.OptionContainer: add_options, format_description, get_option, has_option, remove_option, set_conflict_handler, set_description

Inherited from optparse.OptionContainer (private): _check_conflict, _create_option_mappings, _share_option_mappings

Class Variables [hide private]

Inherited from optparse.OptionParser: standard_option_list

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 
Overrides: optparse.OptionContainer.__init__

add_option(self, *args, **kwargs)

source code 

Add a new option - like OptionParser.add_option.

The long options will be added to the list of boot args, unless the keyword argument 'bootarg' is set to False.

Positional arguments that don't start with '-' are considered extra boot args to look for.

NOTE: conflict_handler is currently ignored for boot args - they will always raise OptionConflictError if they conflict.

Overrides: optparse.OptionContainer.add_option

parse_boot_cmdline(self, cmdline, values=None)

source code 

Parse the boot cmdline and set appropriate values according to the options set by add_option.

cmdline can be given as a string (to be parsed by BootArgs), or a dict (or any object with .iteritems()) of {bootarg:value} pairs.

If cmdline is None, the cmdline data will be whatever BootArgs reads by default (/proc/cmdline, /run/initramfs/etc/cmdline, /etc/cmdline).

If an option requires a value but the boot arg doesn't provide one, we'll quietly not set anything.

parse_args(self, args=None, values=None, cmdline=None)

source code 

Like OptionParser.parse_args(), but also parses the boot cmdline. (see parse_boot_cmdline for details on that process.) Commandline arguments will override boot arguments.

Overrides: optparse.OptionParser.parse_args