Commit 2cba6d95 authored by Peter V. Saveliev's avatar Peter V. Saveliev

ndb.report: publish filter results in cli

parent 7830d224
...@@ -30,6 +30,7 @@ Filtering examples:: ...@@ -30,6 +30,7 @@ Filtering examples::
''' '''
import json import json
from itertools import chain from itertools import chain
from pyroute2 import cli
from pyroute2.common import basestring from pyroute2.common import basestring
MAX_REPORT_LINES = 10000 MAX_REPORT_LINES = 10000
...@@ -174,6 +175,7 @@ class RecordSet(BaseRecordSet): ...@@ -174,6 +175,7 @@ class RecordSet(BaseRecordSet):
to make chains of filters. to make chains of filters.
''' '''
@cli.show_result
def transform(self, **kwarg): def transform(self, **kwarg):
''' '''
Transform record fields with a provided functions:: Transform record fields with a provided functions::
...@@ -208,6 +210,7 @@ class RecordSet(BaseRecordSet): ...@@ -208,6 +210,7 @@ class RecordSet(BaseRecordSet):
return RecordSet(g()) return RecordSet(g())
@cli.show_result
def filter(self, f=None, **kwarg): def filter(self, f=None, **kwarg):
''' '''
Filter records. This function may be called in two ways. One way Filter records. This function may be called in two ways. One way
...@@ -241,6 +244,7 @@ class RecordSet(BaseRecordSet): ...@@ -241,6 +244,7 @@ class RecordSet(BaseRecordSet):
return RecordSet(g()) return RecordSet(g())
@cli.show_result
def select(self, *argv): def select(self, *argv):
''' '''
Select fields from records:: Select fields from records::
...@@ -256,6 +260,7 @@ class RecordSet(BaseRecordSet): ...@@ -256,6 +260,7 @@ class RecordSet(BaseRecordSet):
return RecordSet(g()) return RecordSet(g())
@cli.show_result
def join(self, right, condition=lambda r1, r2: True, prefix=''): def join(self, right, condition=lambda r1, r2: True, prefix=''):
''' '''
Join two reports. Join two reports.
...@@ -298,6 +303,7 @@ class RecordSet(BaseRecordSet): ...@@ -298,6 +303,7 @@ class RecordSet(BaseRecordSet):
return RecordSet(g()) return RecordSet(g())
@cli.show_result
def format(self, kind): def format(self, kind):
''' '''
Convert report records into other formats. Supported formats are Convert report records into other formats. Supported formats are
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment