Skip to content

Commit

Permalink
added lines feature for rows
Browse files Browse the repository at this point in the history
  • Loading branch information
nishant-dash committed Dec 21, 2023
1 parent 52d06b1 commit 8e95551
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rtab/base_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, **kwargs) -> None:
"""Initialize input dict as class attributes."""
self.table = None
self.wrap = False
self.lines = False
for k, v in kwargs.items():
setattr(self, k, v)

Expand All @@ -31,7 +32,7 @@ def load(self, data) -> dict: # pylint: disable=missing-type-doc
def create_table(self) -> Table:
"""Create a rich table object."""
# pylint: disable=maybe-no-member
self.table = Table(box=box.ROUNDED, highlight=not self.quiet)
self.table = Table(box=box.ROUNDED, highlight=not self.quiet, show_lines=self.lines)

def add_column(self, column: str = ""):
"""Add a column to a rich table object.
Expand Down
11 changes: 11 additions & 0 deletions rtab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ def main( # pylint: disable=too-many-arguments
rich_help_panel="Modifiers",
),
] = False,
lines: Annotated[
bool,
typer.Option(
"-l",
"--lines",
help="Show lines between rows",
rich_help_panel="Modifiers",
),
] = False,
rules: Annotated[
str,
typer.Option(
Expand Down Expand Up @@ -119,6 +128,7 @@ def main( # pylint: disable=too-many-arguments
:param separator: Specify a separator, only applies with table input '-t'
:param rules: Add special highlighting ruels such as openstack, juju, etc...
:param wrap: Allow wrapping of text in rows, helpful if row is long
:param lines: Show lines between rows
:param file: Specify a file (file extension matters!)
:raises Exit: 1 if no defining input is provided
"""
Expand All @@ -128,6 +138,7 @@ def main( # pylint: disable=too-many-arguments
"separator": separator,
"rules": rules,
"wrap": wrap,
"lines": lines,
}
if file:
obj = FileToRichTable(**extra_options)
Expand Down

0 comments on commit 8e95551

Please sign in to comment.