Created
December 25, 2012 15:22
-
-
Save NIA/4373705 to your computer and use it in GitHub Desktop.
Creating help text from map of commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val commands = ListMap( | |
"updates" -> "show the last updates", | |
"help" -> "that is, print this text", | |
"exit" -> "nuff said, quit the program", | |
"upupup" -> "Tumc tumc tumc" | |
) | |
val helpTabStop = 8 | |
val helpText = "Commands list:\n" + commands.collect({ | |
case (cmd, desc) => cmd + " "*(helpTabStop - cmd.length) + "- " + desc | |
}).mkString("\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment