blob: e7b572b15acfd01b079e04ceec64f19192c47dd9 [file] [log] [blame]
Radek Krejci5819f7c2019-05-31 14:53:29 +02001.\" Manpage for yanglint.
2.\" Process this file with
3.\" groff -man -Tascii yangre.1
4.\"
5
6.TH YANGRE 1 "2018-11-09" "libyang"
7.SH NAME
8yangre \- YANG regular expression processor
9.
10.SH SYNOPSIS
11.B yangre
12[\-V] \-p \fIREGEXP\fP [\-i] [\-p \fIREGEXP\fP [\-i]...] \fISTRING\fP
13.br
14.B yangre
15[\-V] \-f \fIFILE\fP
16.
17.SH DESCRIPTION
18\fByangre\fP is a command-line tool to test and evaluate regular expressions
19for use in YANG schemas. Supported regular expressions are defined by the
20W3C's XML-Schema standard.
21
22\fByangre\fP can be used either with regular expressions and a target string
23on the command line or with input from a file. The latter is particularly
24useful to avoid dealing with proper shell escaping of regular expression
25patterns, which can be somewhat tricky.
26.
27.SH GENERAL OPTIONS
28.TP
29.BR "\-h\fR,\fP \-\^\-help"
30.br
31Outputs usage help and exits.
32.TP
33.BR "\-v\fR,\fP \-\^\-version"
34.br
35Outputs the version number and exits.
36.TP
37.BR "\-V\fR,\fP \-\^\-verbose"
38Increases the verbosity level. If not specified, only errors are printed, with
39each appearance it adds: warnings, verbose messages, debug messages (if compiled
40with debug information).
41.SH COMMAND LINE INPUT
42.TP
43.BR "\-p \fIREGEXP\fP\fR,\fP \-\^\-pattern=\fIREGEXP\fP"
44.br
45One or more regular expression patterns to be tested against the input
46string. Supplied expressions are tested in the order they appear on the
47command line. Testing is aborted when an expression does not match (or
48does match, if the \fB-i\fP option is used.)
49.TP
50.BR "\-i\fR,\fP \-\^\-invert-match"
51.br
52Reverse match condition for the previous pattern. If the pattern matches,
53an error is printed and evaluation is aborted.
54.TP
55.BR "\fISTRING\fP"
56.br
57Target text input to match the regular expression(s) against. The same
58text is used for all regular expressions. Note that only the first
59argument is used by \fByangre\fP, if it contains spaces or other shell
60metacharacters they must be properly escaped. Additional arguments are
61silently ignored.
62.SH FILE INPUT
63.TP
64.BR "\-f \fIFILE\fP\fR,\fP \-\^\-file=\fIFILE\fP"
65Read both patterns and target text from the specified input file.
66
67\fIFILE\fP must consist of one or more YANG regular expressions, each on
68their own line, followed by a blank line and one line of target text. No
69preprocessing is done on file input, there are no comment lines and
70whitespace is not stripped. A single space character at the beginning of
71a pattern line inverts the match condition for the pattern on that line.
72Patterns must still be properly quoted as mandated by the YANG standard.
73.SH RETURN VALUES
74.TP
750
76.I Successful match
77.br
78The target text matched for all patterns.
79.TP
801
81.I Pattern mismatch
82.br
83One or more patterns did not match the target text. An error message is
84printed to stderr describing which pattern was the first not to match.
85.TP
86255
87.I Other error
88.br
89One or more patterns could not be processed or some other error occurred that
90precluded processing.
91.SH EXAMPLES
92.IP \[bu] 2
93Test a single pattern:
94 yangre -p 'te.*xt' text_text
95.IP \[bu]
96Test multiple patterns:
97 yangre -p '.*pat1' -p 'pat2.*' -p 'notpat' -i pat2testpat1
98.IP \[bu]
99Input from a file:
100 cat > /tmp/patterns <<EOF
101 .*pat1
102 pat2.*
103 notpat
104
105 pat2testpat1
106 EOF
107 yangre -f /tmp/patterns
108
109.SH SEE ALSO
110https://github.com/CESNET/libyang (libyang homepage and Git repository)
111.
112.SH AUTHORS
113Radek Krejci <rkrejci@cesnet.cz>, Michal Vasko <mvasko@cesnet.cz>
114.br
115This man page was written by David Lamparter <equinox@diac24.net>
116.
117.SH COPYRIGHT
118Copyright \(co 2015-2018 CESNET, a.l.e.