![]() |
![]()
| ![]() |
![]()
NAME
LIBRARYshtk_import config SYNOPSIS
DESCRIPTIONThe Overrides are values given to configuration variables that can be set before the configuration file is loaded with shtk_config_load(3). This feature is useful to support parsing all command line flags before attempting to load the configuration file, as the script should first validate all user input before performing any action. EXAMPLESThis code snippet illustrates a program with a configuration file
that supports a VERBOSE variable and that, for
convenience reasons, can be overriden via the command line using the
shtk_config_init VERBOSE local OPTIND while getopts ':v' arg "${@}"; do case "${arg}" in v) # Enable verbose mode. shtk_config_override VERBOSE=yes ;; \?) shtk_cli_usage_error "Unknown option -${OPTARG}" ;; esac done shift $((${OPTIND} - 1)) shtk_config_set VERBOSE no # Set the default value. shtk_config_load "/etc/my_program.conf" SEE ALSOHISTORY
|