Blame tools/re/yangre.1

Packit Service 311553
.\" Manpage for yanglint.
Packit Service 311553
.\" Process this file with
Packit Service 311553
.\" groff -man -Tascii yangre.1
Packit Service 311553
.\"
Packit Service 311553
Packit Service 311553
.TH YANGRE 1 "2018-11-09" "libyang"
Packit Service 311553
.SH NAME
Packit Service 311553
yangre \- YANG regular expression processor
Packit Service 311553
.
Packit Service 311553
.SH SYNOPSIS
Packit Service 311553
.B yangre
Packit Service 311553
[\-V] \-p \fIREGEXP\fP [\-i] [\-p \fIREGEXP\fP [\-i]...] \fISTRING\fP
Packit Service 311553
.br
Packit Service 311553
.B yangre
Packit Service 311553
[\-V] \-f \fIFILE\fP
Packit Service 311553
.
Packit Service 311553
.SH DESCRIPTION
Packit Service 311553
\fByangre\fP is a command-line tool to test and evaluate regular expressions
Packit Service 311553
for use in YANG schemas.  Supported regular expressions are defined by the
Packit Service 311553
W3C's XML-Schema standard.
Packit Service 311553
Packit Service 311553
\fByangre\fP can be used either with regular expressions and a target string
Packit Service 311553
on the command line or with input from a file.  The latter is particularly
Packit Service 311553
useful to avoid dealing with proper shell escaping of regular expression
Packit Service 311553
patterns, which can be somewhat tricky.
Packit Service 311553
.
Packit Service 311553
.SH GENERAL OPTIONS
Packit Service 311553
.TP
Packit Service 311553
.BR "\-h\fR,\fP \-\^\-help"
Packit Service 311553
.br
Packit Service 311553
Outputs usage help and exits.
Packit Service 311553
.TP
Packit Service 311553
.BR "\-v\fR,\fP \-\^\-version"
Packit Service 311553
.br
Packit Service 311553
Outputs the version number and exits.
Packit Service 311553
.TP
Packit Service 311553
.BR "\-V\fR,\fP \-\^\-verbose"
Packit Service 311553
Increases the verbosity level. If not specified, only errors are printed, with
Packit Service 311553
each appearance it adds: warnings, verbose messages, debug messages (if compiled
Packit Service 311553
with debug information).
Packit Service 311553
.SH COMMAND LINE INPUT
Packit Service 311553
.TP
Packit Service 311553
.BR "\-p \fIREGEXP\fP\fR,\fP \-\^\-pattern=\fIREGEXP\fP"
Packit Service 311553
.br
Packit Service 311553
One or more regular expression patterns to be tested against the input
Packit Service 311553
string.  Supplied expressions are tested in the order they appear on the
Packit Service 311553
command line.  Testing is aborted when an expression does not match (or
Packit Service 311553
does match, if the \fB-i\fP option is used.)
Packit Service 311553
.TP
Packit Service 311553
.BR "\-i\fR,\fP \-\^\-invert-match"
Packit Service 311553
.br
Packit Service 311553
Reverse match condition for the previous pattern.  If the pattern matches,
Packit Service 311553
an error is printed and evaluation is aborted.
Packit Service 311553
.TP
Packit Service 311553
.BR "\fISTRING\fP"
Packit Service 311553
.br
Packit Service 311553
Target text input to match the regular expression(s) against.  The same
Packit Service 311553
text is used for all regular expressions.  Note that only the first
Packit Service 311553
argument is used by \fByangre\fP, if it contains spaces or other shell
Packit Service 311553
metacharacters they must be properly escaped.  Additional arguments are
Packit Service 311553
silently ignored.
Packit Service 311553
.SH FILE INPUT
Packit Service 311553
.TP
Packit Service 311553
.BR "\-f \fIFILE\fP\fR,\fP \-\^\-file=\fIFILE\fP"
Packit Service 311553
Read both patterns and target text from the specified input file.
Packit Service 311553
Packit Service 311553
\fIFILE\fP must consist of one or more YANG regular expressions, each on
Packit Service 311553
their own line, followed by a blank line and one line of target text.  No
Packit Service 311553
preprocessing is done on file input, there are no comment lines and
Packit Service 311553
whitespace is not stripped.  A single space character at the beginning of
Packit Service 311553
a pattern line inverts the match condition for the pattern on that line.
Packit Service 311553
Patterns must still be properly quoted as mandated by the YANG standard.
Packit Service 311553
.SH RETURN VALUES
Packit Service 311553
.TP
Packit Service 311553
0
Packit Service 311553
.I Successful match
Packit Service 311553
.br
Packit Service 311553
The target text matched for all patterns.
Packit Service 311553
.TP
Packit Service 311553
1
Packit Service 311553
.I Pattern mismatch
Packit Service 311553
.br
Packit Service 311553
One or more patterns did not match the target text.  An error message is
Packit Service 311553
printed to stderr describing which pattern was the first not to match.
Packit Service 311553
.TP
Packit Service 311553
255
Packit Service 311553
.I Other error
Packit Service 311553
.br
Packit Service 311553
One or more patterns could not be processed or some other error occurred that
Packit Service 311553
precluded processing.
Packit Service 311553
.SH EXAMPLES
Packit Service 311553
.IP \[bu] 2
Packit Service 311553
Test a single pattern:
Packit Service 311553
    yangre -p 'te.*xt' text_text
Packit Service 311553
.IP \[bu]
Packit Service 311553
Test multiple patterns:
Packit Service 311553
    yangre -p '.*pat1' -p 'pat2.*' -p 'notpat' -i pat2testpat1
Packit Service 311553
.IP \[bu]
Packit Service 311553
Input from a file:
Packit Service 311553
    cat > /tmp/patterns <
Packit Service 311553
    .*pat1
Packit Service 311553
    pat2.*
Packit Service 311553
     notpat
Packit Service 311553
Packit Service 311553
    pat2testpat1
Packit Service 311553
    EOF
Packit Service 311553
    yangre -f /tmp/patterns
Packit Service 311553
Packit Service 311553
.SH SEE ALSO
Packit Service 311553
https://github.com/CESNET/libyang (libyang homepage and Git repository)
Packit Service 311553
.
Packit Service 311553
.SH AUTHORS
Packit Service 311553
Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz>
Packit Service 311553
.br
Packit Service 311553
This man page was written by David Lamparter <equinox@diac24.net>
Packit Service 311553
.
Packit Service 311553
.SH COPYRIGHT
Packit Service 311553
Copyright \(co 2015-2018 CESNET, a.l.e.