SHTK_CONFIG_OVERRIDE(3)
β¨ SHTK_CONFIG_OVERRIDE(3) β¨
okay so bestie, this is a page from the Library Functions Manual and it's literally all about shtk_config_override π
(yes the manual name is right there in the title, iykyk)
π NAME π
shtk_config_override β records an override to be applied to the configuration β¨
π¦ LIBRARY π¦
shtk_import config
πΈ SYNOPSIS πΈ
shtk_config_override override
π DESCRIPTION π
The shtk_config_override function records the override you hand it in override, which must have the form βvariable=valueβ. no cap, that's the whole shape, don't get creative π«Ά
So what even is an override? It's a value given to a configuration variable that you can set before the configuration file gets loaded with shtk_config_load(3). Obsessed, honestly. This feature is genuinely useful for supporting parsing all the command line flags before you even attempt to load the configuration file β because the script should always validate all user input before performing any action. main character energy: validate first, act later π
π EXAMPLES π
This 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 -v flag π
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 ALSO π§
β HISTORY β
shtk_config_override first appeared in shtk 1.0.
ok that's the whole page, go forth and override responsibly π
Debian Β· November 6, 2014 β mwah π this one's signed off with love, xoxo your favorite manpage bestie ππ
π¦ where this page comes from
- nixos 26.05: shtk 1.7
- nixpkgs unstable: shtk 1.7
- Copyright 2014 Google Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms