This moves the command extension parsing code over to the main library since it can be potentially useful for others.