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