I know you're trying to make things functional for both Linux & MacOS, so some care would be required there; but I'd recommend taking a look at GNU getopt or getopts for argument processing & parsing.
Additionally, I'd personally set default values to variables set in the argument parse loop before the loop occurrs -- that way you don't need to check if a variable is undefined before setting a value.
Here's how I'd rewrite the argparse loop & variable definitions. This would have the added benefit of allowing the user to condense multiple short options into on string (eg -ku
)...though, YMMV with MacOS support, as I'm wholly unfamiliar with that platform):
mode="fzf"