[gen] using getopt for options