bhyve easyscript

#!/usr/bin/env bash
#settings
memory="4G"
cpu="2"
interface="tap0"
cdrom="NONE"
name="dfly"
drive="/dev/zvol/root/suplbup/virtualbox/dfly"
com="-l com1,stdio"
efi="-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI_CSM.fd"
framebuffer="fbuf,tcp=0.0.0.0:5900,w=1600,h=900,wait"

help="\n$0 -e|--efi -s=|--com= -f=|--framebuffer -d=|--drive= -n=|--name= -c=|--cdrom= -i=|--interface= -u=|--cpu= -m=|--memory=\nDEFAULTS\nmemory=$memory\ncpu=$cpu\ninterface=$interface\nname=$name\ndrive=$drive\ncdrom=$cdrom\nefi=$efi\ncom=$com\nframebuffer=$framebuffer"
bootrom=$com

if [ $# == 0 ]
then
    printf "$help"
else
for i in "$@"
do
case $i in
    -d=*|--drive=*)
    drive="${i#*=}"
    shift # past argument=value
    ;;
    -n=*|--name=*)
    name="${i#*=}"
    shift # past argument=value
    ;;
    -c=*|--cdrom=*)
    cdrom="${i#*=}"
    shift # past argument=value
    ;;
    -i=*|--interface=*)
    interface="${i#*=}"
    shift # past argument=value
    ;;
    -u=*|--cpu=*)
    cpu="${i#*=}"
    shift # past argument with no value
    ;;
    -m=*|--memory=*)
    memory="${i#*=}"
    shift # past argument with no value
    ;;
    -h|--help)
       printf "$help"
       exit
    ;;
    -s=*|--com=*)
       com="${i#*=}"
       bootrom="$com"
       shift
    ;;
    -e|--efi)
       bootrom="$com $efi"
    ;;
    -f=*|--framebuffer=*)
       framebuffer="${i#*=}"
       shift
    ;;
    default)
       echo "option ${i#} not available"
    ;;
esac
done
if [ $cdrom != "NONE" ]
then
cdline=" -s 3,ahci-cd,$cdrom "
else
cdline=" "
fi
bhyve -c $cpu -m $memory -A -H -P -s 0,hostbridge$cdline-s 4,ahci-hd,$drive -s 5,virtio-net,$interface -s 29,$framebuffer -s 30,xhci,tablet -s 31,lpc $bootrom $name
fi