SHTK_CONFIG_OVERRIDE(3)

πŸ“¦ version 1.7, in nixos 26.05, nixpkgs unstable

✨ 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 🧚

shtk(3), shtk_config(3)


⭐ 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