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