Skip to content

Commit

Permalink
Merge 2b77be0 into e6cdbed
Browse files Browse the repository at this point in the history
  • Loading branch information
alintulu committed Oct 12, 2020
2 parents e6cdbed + 2b77be0 commit 59ca7cf
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions reana_commons/utils.py
Expand Up @@ -32,7 +32,7 @@
)


def click_table_printer(headers, _filter, data):
def click_table_printer(headers, _filter, data, colours=None):
"""Generate space separated output for click commands."""
_filter = [h.lower() for h in _filter] + [h.upper() for h in _filter]
header_indexes = [i for i, item in enumerate(headers)]
Expand All @@ -54,10 +54,13 @@ def click_table_printer(headers, _filter, data):
formatted_output = " ".join(formatted_output_parts)
# Print the table with the headers capitalized
click.echo(formatted_output.format(*[h.upper() for h in headers]))
for row in data:
for i, row in enumerate(data):
if header_indexes:
row = [row[i] for i in header_indexes]
click.echo(formatted_output.format(*row))
click.secho(
formatted_output.format(*row),
fg=colours[i] if colours and len(colours) == len(data) else None,
)


def calculate_hash_of_dir(directory, file_list=None):
Expand Down

0 comments on commit 59ca7cf

Please sign in to comment.