New -list-web-services option

This will make it possible for the Debian package to fetch the list of
supported built-in web-based IP discovery services and prompt the user
to choose one upon installation.
This commit is contained in:
Richard Hansen 2020-08-02 16:49:28 -04:00
parent 791890741b
commit dd10696156

View file

@ -816,6 +816,10 @@ my %opt = ();
my $deprecated_handler = sub { warning("'-$_[0]' is deprecated and does nothing"); }; my $deprecated_handler = sub { warning("'-$_[0]' is deprecated and does nothing"); };
$opt{'fw-banlocal'} = $deprecated_handler; $opt{'fw-banlocal'} = $deprecated_handler;
$opt{'if-skip'} = $deprecated_handler; $opt{'if-skip'} = $deprecated_handler;
$opt{'list-web-services'} = sub {
printf("%s %s\n", $_, $builtinweb{$_}{url}) for sort(keys(%builtinweb));
exit(0);
};
my @opt = ( my @opt = (
"usage: ${program} [options]", "usage: ${program} [options]",
@ -839,8 +843,9 @@ my @opt = (
["if", "=s", "-if <interface> : obtain IP address from <interface>"], ["if", "=s", "-if <interface> : obtain IP address from <interface>"],
"", "",
" Options that apply to 'use=web':", " Options that apply to 'use=web':",
["web", "=s", "-web <service>|<url> : obtain IP address from a web-based IP discovery service, either a known <service> or a custom <url>"], ["web", "=s", "-web <service>|<url> : obtain IP address from a web-based IP discovery service, either a known <service> (see '-list-web-services') or a custom <url>"],
["web-skip", "=s", "-web-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the web-based IP discovery service"], ["web-skip", "=s", "-web-skip <pattern> : skip any IP addresses before <pattern> in the text returned from the web-based IP discovery service"],
["list-web-services", "", "-list-web-services : print a machine-readable list of web-based IP discovery services for use with 'web=<service>' and exit. Format: one service per line, each line has the form '<service> <url>'"],
"", "",
" Options that apply to 'use=fw' and 'use=<device>':", " Options that apply to 'use=fw' and 'use=<device>':",
["fw", "=s", "-fw <address>|<url> : obtain IP address from device with IP address <address> or URL <url>"], ["fw", "=s", "-fw <address>|<url> : obtain IP address from device with IP address <address> or URL <url>"],