Configuration for the namelist diff tool follows the XDG standard. The configuration should be stored in a YAML file.
You can use the function write_default_config to generate a configuration file with the hard-coded defaults. Command line access for this command is available via:
$ nmldiff --write-default-config
The default configuration will be written to ${XDG_CONFIG_HOME}/nmldiff/nmldiff.yaml
${XDG_CONFIG_HOME}/nmldiff/nmldiff.yaml
Configuration is loaded in the following order:
Command line Config file thats name is declared on the command line. Environment vars Local config file (if exists) Global config file (if exists) Hard-coded defaults in the code
Command line
Config file thats name is declared on the command line.
Environment vars
Local config file (if exists)
Global config file (if exists)
Hard-coded defaults in the code
namelist_diff.config.
AppConfig
Bases: everett.component.RequiredConfigMixin
everett.component.RequiredConfigMixin
Contains the defaults for the nmldiff configuration
required_config
CONFIG_FILES
List of files where configuration information is searched for
get_config
Loads the configuration
Loads either the user supplied configuration, the configuration in the XDG path, or the default config. Configuration may be given incompletely, so if you only supply the color (for example), other configuration values are taken from the defaults. The user can also supply a configuration as a dictionary as an argument to this function, this takes first priority.
Which config to load
The configuration to use
>>> config = get_config() >>> debug = config.get("debug") # Evaluates to whatever debug is set in # the first configuration found
write_default_config
Creates a default configuration file under the XDG Base Directory nmldiff/nmldiff.yaml
Main module.
namelist_diff.namelist_diff.
NamelistDiff
Bases: object
object
diff
ansi_ljust
check_longest_line
color_green
color_red
color_string
color_yellow
determine_print_color
determine_print_prefix
format_entry
format_nml
format_remaining_diff
namelist_to_iter
Top-level package for Namelist Diff.