convert to Getopt options parsing