init_config: Support any variable as a command-line arg

This doesn't add any new command-line arguments, but it does mean that
a new command-line argument can be added for any variable, not just
those in `$variables{'global-defaults'}`, and its value will be copied
to `%globals`.

My main motivation for this commit is to make it possible to remove
the redundant variable declarations between
`$variables{'global-defaults'}` and
`$variables{'protocol-common-defaults'}`.
This commit is contained in:
Richard Hansen 2024-08-18 02:44:40 -04:00
parent b9ec2d42a3
commit 533e4735cd

View file

@ -1923,9 +1923,7 @@ sub init_config {
## override global options with those on the command-line.
for my $o (keys %opt) {
# TODO: Why is this limited to $variables{'global-defaults'}? Why not
# $variables{'merged'}?
if (defined $opt{$o} && exists $variables{'global-defaults'}{$o}) {
if (defined $opt{$o} && exists $variables{'merged'}{$o}) {
# TODO: What's the point of this? The opt() function will fall back to %globals if
# %opt doesn't have a value, so this shouldn't be necessary.
$globals{$o} = $opt{$o};