Skip to content

Commit

Permalink
DevconfigCmd: add support for matching line/section
Browse files Browse the repository at this point in the history
Signed-off-by: Dinesh Dutt <[email protected]>
  • Loading branch information
ddutt committed May 27, 2024
1 parent 51e4779 commit 570ffb4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions suzieq/cli/sqcmds/DevconfigCmd.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
from nubia import command
from nubia import command, argument

from suzieq.cli.sqcmds.command import SqTableCommand
from suzieq.sqobjects.devconfig import DevconfigObj


@command("devconfig", help="Act on device data")
@argument("section",
description="show device config only for this regex match")
class DevconfigCmd(SqTableCommand):
"""Device configurations"""

Expand All @@ -19,6 +21,7 @@ def __init__(
format: str = "", # pylint: disable=redefined-builtin
query_str: str = " ",
columns: str = "default",
section: str = '',
) -> None:
super().__init__(
engine=engine,
Expand All @@ -33,10 +36,12 @@ def __init__(
sqobj=DevconfigObj,
)

self.lvars['section'] = section

@command("show", help="Show device information")
def show(self):
"""Show device config info
"""
if not self.format or (self.format == 'text'):
self.format = 'devconfig'
self.format = 'markdown'
return super().show()

0 comments on commit 570ffb4

Please sign in to comment.