Application Kata "More"
Write a console application that outputs the contents of a text file page by page. The application is called as follows:
c:\> more
It displays the first page of the text file (page length = 20 lines) and waits for a keystroke to display the next page and so on. The display can be canceled with the [Esc] key.
Example [1]:
c:\> more advent.txt The night is blue, the stars are twinkling, Snowflakes sink softly down. On Edeltaennlein's green top A little white tip piles up. ... So she came to terms with herself: It has to be on St. Nicholas' Eve. --- Continue with each key. Cancel with [Esc]. ---
After pressing [Spacebar], for example, it would continue like this:
And when the little deer went to rest, the little hare closed her eyes, ... Full of care she lays limb upon limb (which her husband has so far avoided)-, --- Continue with each key. Abort with [Esc]. ---
etc.
Variation #1
Allow the optional specification of a page length on the command line, e.g.
c:\> more advent.txt
15
Variation #2
Show the current page number and the total time before the text of the page, e.g.
c:\> more advent.txt