Reduce code duplication in argument parsing.
Merge pull request #12 from stairclimber/pull-request-3

Reduce code duplication in argument parsing (based on ros-infrastructure/ros_buildfarm#11)