move get-opts to cli function.