fab.tools.flags#
This file contains a simple Flag class to manage tool flags. It will need to be combined with build_config.FlagsConfig in a follow up PR.
Classes
|
This class represents a list of parameters for a tool. |
A list of flags that support a 'profile' to be used. |
- class fab.tools.flags.Flags(list_of_flags=None)#
This class represents a list of parameters for a tool. It is a list with some additional functionality.
TODO #22: This class and build_config.FlagsConfig should be combined.
- Parameters:
list_of_flags (
Optional
[List
[str
]]) – List of parameters to initialise this object with. (default:None
)
- add_flags(new_flags)#
Adds the specified flags to the list of flags.
- remove_flag(remove_flag, has_parameter=False)#
Removes all occurrences of remove_flag in flags. If has_parameter is defined, the next entry in flags will also be removed, and if this object contains this flag+parameter without space (e.g. -J/tmp), it will be correctly removed. Note that only the flag itself must be specified, you cannot remove a flag only if a specific parameter is given (i.e. remove_flag=”-J/tmp” will not work if this object contains […,”-J”, “/tmp”]).
- class fab.tools.flags.ProfileFlags#
A list of flags that support a ‘profile’ to be used. If no profile is specified, it will use “” (empty string) as ‘profile’. All functions take an optional profile parameter, so this class can also be used for tools that do not need a profile.
- define_profile(name, inherit_from=None)#
Defines a new profile name, and allows to specify if this new profile inherit settings from an existing profile. If inherit_from is specified, the newly defined profile will inherit from an existing profile (including the default profile “”).
- add_flags(new_flags, profile=None)#
Adds the specified flags to the list of flags.
- remove_flag(remove_flag, profile=None, has_parameter=False)#
Removes all occurrences of remove_flag in flags. If has_parameter is defined, the next entry in flags will also be removed, and if this object contains this flag+parameter without space (e.g. -J/tmp), it will be correctly removed. Note that only the flag itself must be specified, you cannot remove a flag only if a specific parameter is given (i.e. remove_flag=”-J/tmp” will not work if this object contains […,”-J”, “/tmp”]).