openSUSE / docserv

A server for building and publishing documentation with DAPS
https://opensuse.github.io/docserv/
GNU General Public License v3.0
4 stars 3 forks source link

Use getopt for stitch and build-nav #269

Open ghost opened 3 years ago

ghost commented 3 years ago
via @tomschr , for stitch ``` ME="${0##*/}" export POSIXLY_CORRECT=1 ARGS=$(getopt -o "h" -l "help,simplify,revalidate-only,spinner,valid-languages:,site-sections:" -n "$ME" -- "$@") eval set -- "$ARGS" while true; do case "$1" in -h|--help|--simplify|--revalidate-only|--spinner) echo "Found option $1" shift ;; --valid-languages|--site-sections) echo "Found option $1 with value '$2'" shift 2 break ;; --) shift break ;; --*) echo "Found unknown option $1" shift ;; esac done unset POSIXLY_CORRECT ``` cf https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash