2485 shaares
83 private links
83 private links
Showing how to combine short (-h
) posix options with long-form (--help
) gnu-like options while using getopts.
It seems overkill for smaller applications which are probably best off with a simple snippet like:
while :; do
case "$1" in
-f | --file) BEMOJI_CUSTOM_LIST="${OPTARG}"; shift 2 ;;
-h | --help) usage 0 ;;
-p | --private) bm_private_mode=true; shift ;;
-v | --version) version ;;
-*) usage 1 ;;
*) break ;;
esac
done
for option gathering, but for more complex setups this could be the way to go.