Refactor command-line parser and add version flag to k, klr and kpm

Another approach to add version flags. @davidfowl , please help to compare it with the approach in #307 
This logic might be broken on mono. I'll try to verify this