Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Can't add a separator before last row #14
Hi, just getting started with this lib, however I need to add a separator before the last row and I don't see how, is it possible to do it?
That final row (
@ZzAntares Sadly it doesn't support this at the moment.
This is a substantial amount of work, I will attempt to get to it soon but I can't make any promises unless someone else would like to pick it up (and we can then better spec out what the new API would look like).
That's one hack, another probably visually better hack is to take advantage of the fact it just returns a string and insert a new row that way. Given the example:
header = ["Artist", "Track", "Label", "Year"] rows = [ ["Konflict", "Cyanide", "Renegade Hardware", 1999], ["Marcus Intalex", "Temperance", "Soul:r", 2004], ["Kryptic Minds", "The Forgotten", "Defcom Records", 2007] ] # Split the output on new lines and store the list for later. table = TableRex.quick_render!(rows, header) |> String.split("\n") # Take the first line as we can duplicate it and reinsert. separator = table |> Enum.at(0) table # Reinsert the separator line into the table list. |> List.insert_at(-4, separator) # Turn the table list back into a newline-joined string. |> Enum.join("\n") # To display it. |> IO.puts
Output would look like this:
Hope it helps? Wish it was a proper solution. I'm leaving this ticket open to serve as a reminder both to me when I get a chance or anyone that wants to pick it up.