Agility Kata "CSV-Viewer I"

Write an application that displays CSV files to the console. [1] The application should be called on the console like in the following example:

C:\>csvviewer.exe persons.csv

Starting the application produces the following output to the console: [2]

Name |Age|City |
Peter|42 |New York|
Paul |57 |London |
Mary |35 |Munich |
F)irst page, P)revious page, N)ext page, L)ast page, E)xit

Pages with records are displayed as a table with a header row and cell borders as shown. The corresponding file looks like this; with a page length of 3 records, they would be displayed as three pages:

Peter;42;New York

Each line contains one record; the first line contains the column names; columns are separated by ";". The content of the record fields is simple: no line breaks, no field separators, no processing of values in "". The encoding of CSV text files is UTF-8.

Please note! This is only an example. Concrete CSV files may differ in the number of columns and the column names! Person with the properties Name, Age and City to create.

The page length should be an appropriate standard for your platform's console windows, but can also be passed to the application as follows:

C:\>csvviewer.exe persons.csv 40

The page table should have fixed column widths corresponding to the longest value for each column within a page.

[1] For this exercise, we will use a console frontend, because it is the lowest common denominator in terms of frontend for all platforms. Whether you are using Python or C# or Java, you should be able to put a console frontend on top of any business logic. Of course, a GUI would be more stylish, but it would also distract from the main challenges of the exercise.

[2] Assume that all CSV files contain only lines with a length corresponding to one display line. Therefore, no horizontal scrolling is required. However, most likely all lines are of different length.