1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
.\" SPDX-FileCopyrightText: Peter Pentchev <roam@ringlet.net>
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.Dd April 21, 2018
.Dt FEATURE-CHECK 1
.Os
.Sh NAME
.Nm feature-check
.Nd query a program for supported features
.Sh SYNOPSIS
.Nm
.Op Fl v
.Op Fl O Ar optname
.Op Fl P Ar prefix
.Ar program
.Ar feature-name
.Nm
.Op Fl O Ar optname
.Op Fl P Ar prefix
.Ar program
.Ar feature-name
.Ar op
.Ar version
.Nm
.Op Fl O Ar optname
.Op Fl o Ar json|tsv
.Op Fl P Ar prefix
.Fl l
.Ar program
.Nm
.Fl V | Fl h
.Nm
.Fl -features
.Sh DESCRIPTION
The
.Nm
tool obtains the list of supported features from a program via various
methods (e.g. running it with the
.Fl -features
command-line option) and allows other programs to check for the presence
and, possibly, versions of specific features.
.Pp
Options:
.Bl -tag -width indent
.It Fl -features
List the compile-time features supported by this version of
.Nm :
.Bl -tag -width indent
.It Dv feature-check
Always present, with the version of the
.Nm
tool.
.It Dv list
Present if the
.Nm
tool supports fetching the list of features supported by a program.
.It Dv simple
Present if the
.Nm
tool supports comparing the version of a single feature against
a specified version string.
.It Dv single
Present if the
.Nm
tool supports querying a single feature.
.El
.It Fl h , Fl -help
Display program usage output and exit.
.It Fl O Ar optname
Specify the option to pass to the program to obtain its list of
features (default
.Fl -features ) .
.It Fl o Ar format
Specify the output format for the full list of features with the
.Fl l
option.
.It Fl P Ar prefix
Specify the prefix that
.Nm
should look for in the program's output to find the line that contains
the list of features; default "Features: ".
.It Fl V , Fl -version
Display program version output and exit.
.It Fl v
When querying a single feature, output the version obtained for it.
.El
.Sh EXIT STATUS
When querying a single feature,
.Nm
will exit with code 0 if the program supports that feature, and with
a non-zero code when either the program could not be executed, or
its list of features could not be parsed, or the feature was not present.
.Pp
When examining the version of a single feature,
.Nm
will exit with code 0 if the comparison result is true, and with
a non-zero code when either the program could not be executed, or
its list of features could not be parsed, or the comparison failed.
.Pp
When listing the features supported by a program,
.Nm
will exit with code 0 when the list of features was obtained and output,
and with a non-zero code when either the program could not be executed or
its list of features could not be parsed.
.Sh EXAMPLES
.Pp
The following examples are shown as given to the shell:
.Pp
.Dl feature-check curl AsynchDNS
.Pp
Exit with code 0 if the
.Xr curl 1
tool is present and it supports asynchronous DNS lookups.
.Pp
.Dl feature-check -l confget
.Pp
List the features supported by the
.Xr confget 1
tool.
.Pp
.Dl feature-check timelimit 'timelimit ge 1.9'
.Pp
Exit with code 0 if the
.Xr timelimit 1
tool advertises its
.Dv timelimit
feature at version 1.9 or later.
.Pp
.Dl feature-check timelimit timelimit ge 1.9
.Pp
The same check; note that the
.Nm
tool will treat all the arguments after the program name as a single
expression, i.e. it will concatenate them into a single string separated
by spaces and then interpret the string.
.Sh STANDARDS
No standards documentation was harmed in the process of creating
.Nm .
.Sh BUGS
Please report any bugs in
.Nm
to the author.
.Sh AUTHOR
The
.Nm
utility was written by
.An Peter Pentchev Aq roam@ringlet.net
in 2018.
|