extract print_rich_table
This commit is contained in:
@@ -80,6 +80,19 @@ def start_list_exchanges(args: Dict[str, Any]) -> None:
|
|||||||
console.print(table)
|
console.print(table)
|
||||||
|
|
||||||
|
|
||||||
|
def _print_rich_table(summary: str, headers: List[str], tabular_data: List[Dict[str, Any]]) -> None:
|
||||||
|
table = Table(title=summary)
|
||||||
|
|
||||||
|
for header in headers:
|
||||||
|
table.add_column(header, justify="right")
|
||||||
|
|
||||||
|
for row in tabular_data:
|
||||||
|
table.add_row(*[str(row[header]) for header in headers])
|
||||||
|
|
||||||
|
console = Console()
|
||||||
|
console.print(table)
|
||||||
|
|
||||||
|
|
||||||
def _print_objs_tabular(objs: List, print_colorized: bool) -> None:
|
def _print_objs_tabular(objs: List, print_colorized: bool) -> None:
|
||||||
if print_colorized:
|
if print_colorized:
|
||||||
colorama_init(autoreset=True)
|
colorama_init(autoreset=True)
|
||||||
@@ -280,14 +293,7 @@ def start_list_markets(args: Dict[str, Any], pairs_only: bool = False) -> None:
|
|||||||
writer.writeheader()
|
writer.writeheader()
|
||||||
writer.writerows(tabular_data)
|
writer.writerows(tabular_data)
|
||||||
else:
|
else:
|
||||||
table = Table(title=summary_str)
|
_print_rich_table(summary_str, headers, tabular_data)
|
||||||
for header in headers:
|
|
||||||
table.add_column(header, justify="right")
|
|
||||||
for row in tabular_data:
|
|
||||||
table.add_row(*[str(row[header]) for header in headers])
|
|
||||||
|
|
||||||
console = Console()
|
|
||||||
console.print(table)
|
|
||||||
elif not (
|
elif not (
|
||||||
args.get("print_one_column", False)
|
args.get("print_one_column", False)
|
||||||
or args.get("list_pairs_print_json", False)
|
or args.get("list_pairs_print_json", False)
|
||||||
|
|||||||
Reference in New Issue
Block a user