ariel-anieli / grepyang Goto Github PK
View Code? Open in Web Editor NEWGreps through a YANG module, and takes out blocks matching a key
Greps through a YANG module, and takes out blocks matching a key
For example,
# ./grepyang input cancel-commit [email protected]
853: rpc cancel-commit {
862: input {
863: leaf persist-id {
864: type string;
865: description
866: "This parameter is given in order to cancel a persistent
867: confirmed commit. The value must be equal to the value
868: given in the 'persist' parameter to the <commit> operation.
869: If it does not match, the operation fails with an
870: 'invalid-value' error.";
871: }
872: }
872: }
873: }
Lines 872 come back twice; they should not.
The CLI does not incite its usage, and does not prevent misusing.
YANG does contain the inner node
# ./grepyang cancel-commit '[email protected]'
853: rpc cancel-commit {
854: if-feature confirmed-commit;
855: description
856: "This operation is used to cancel an ongoing confirmed commit.
857: If the confirmed commit is persistent, the parameter
858: 'persist-id' must be given, and it must match the value of the
859: 'persist' parameter.";
860: reference "RFC 6241, Section 8.4.4.1";
861:
862: input {
863: leaf persist-id {
864: type string;
865: description
866: "This parameter is given in order to cancel a persistent
867: confirmed commit. The value must be equal to the value
868: given in the 'persist' parameter to the <commit> operation.
869: If it does not match, the operation fails with an
870: 'invalid-value' error.";
871: }
872: }
873: }
Still, if the inner block does not exist, the outer node comes out, blank:
# ./grepyang output cancel-commit '[email protected]'
853: rpc cancel-commit {
873: }
To do: a man page.
This fix solves this issue, but remove the line numbers from output:
# ./grepyang input cancel-commit '[email protected]'
rpc cancel-commit {
input {
leaf persist-id {
type string;
description
"This parameter is given in order to cancel a persistent
confirmed commit. The value must be equal to the value
given in the 'persist' parameter to the <commit> operation.
If it does not match, the operation fails with an
'invalid-value' error.";
}
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.