Add pipe functions

This commit is contained in:
Olof hagsand 2023-07-04 20:48:01 +02:00
parent c16b9cbba4
commit 3858cd93c2
3 changed files with 142 additions and 24 deletions

View file

@ -122,7 +122,13 @@ cat <<EOF > $clidir/clipipe.cli
CLICON_MODE="|mypipe"; # Must start with |
#CLICON_PIPETREE="|mypipe";
\| {
grep <arg:rest>, grep_fn("grep -e", "arg");
grep <arg:string>, pipe_grep_fn("-e", "arg");
except <arg:string>, pipe_grep_fn("-v", "arg");
tail, pipe_tail_fn();
showas {
json, pipe_json_fn();
text, pipe_text_fn();
}
}
EOF
@ -164,6 +170,15 @@ expectpart "$($clixon_cli -1 -m $mode -f $cfg show implicit config \| grep par 2
new "$mode show explicit | grep par"
expectpart "$($clixon_cli -1 -m $mode -f $cfg show explicit config \| grep par)" 0 "<parameter>" "</parameter>" --not-- "table" "value"
new "$mode show explicit | tail"
expectpart "$($clixon_cli -1 -m $mode -f $cfg show explicit config \| tail)" 0 "<name>y</name>" --not-- "<name>x</name>"
new "$mode show explicit | showas json"
expectpart "$($clixon_cli -1 -m $mode -f $cfg show explicit config \| showas json)" 0 '"name": "x",' --not-- "<name>"
new "$mode show explicit | showas text"
expectpart "$($clixon_cli -1 -m $mode -f $cfg show explicit config \| showas text)" 0 "name x;" --not-- "<name>"
new "$mode show treeref explicit | grep par"
expectpart "$($clixon_cli -1 -m $mode -f $cfg show treeref explicit \| grep par)" 0 "<parameter>" "</parameter>" --not-- "table" "value"