This works, but didnt know if it's the right way.
   
  if [[ $2 != --* ]]; then
      shift
      shift
    else
      shift
    fi