Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
diff sbin/fports @ 804:f406b3b76b62
fports: Implemented also long commandline options
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 04 Nov 2024 11:44:47 +0100 |
| parents | 31ff8e5efdd6 |
| children | b59054f11029 |
line wrap: on
line diff
--- a/sbin/fports Mon Nov 04 11:08:15 2024 +0100 +++ b/sbin/fports Mon Nov 04 11:44:47 2024 +0100 @@ -21,18 +21,18 @@ # shellcheck disable=SC2016 # no expansion USAGE=' -USAGE: fports -h - fports -V - fports deptree [-l maxlevel] [-r] [-t] package... - fports detail -n - fports detail -m +USAGE: fports -h|--help + fports -V|--version + fports deptree [-l maxlevel|--maxlevel=maxlevel] [-r|--reverse] [-t|--list|--transitive] package... + fports detail -n|--noauto|--no-auto + fports detail -m|--mapped fports detail package... GLOBAL OPTIONS: - -V Print the program name and version number to stdout and exit + -V, --version Print the program name and version number to stdout and exit. - -h Print this help message to stdout and exit + -h, --help Print this help message to stdout and exit. ' @@ -77,14 +77,15 @@ opt_maxlevel=0 opt_reversed=no opt_flat=no - while getopts "l:rt" opt; do + while getopts "l:rt-:" opt; do + postprocess_getopts_for_long "l:rt-:" opt "maxlevel=" "reverse" "list" "transitive" "" case "${opt}" in - l) + l|maxlevel) opt_maxlevel=$(($OPTARG + 0));; - r) + r|reverse) # shellcheck disable=SC2034 opt_reversed=yes;; - t) + t|list|transitive) opt_flat=yes;; \?) exit 2;; @@ -355,12 +356,13 @@ opt_noauto=no opt_mapped=no - while getopts "nm" opt; do + while getopts "nm-:" opt; do + postprocess_getopts_for_long "nm-:" opt "noauto" "no-auto" "mapped" "" case "${opt}" in - n) + n|noauto|no-auto) # shellcheck disable=SC2034 # appears unused opt_noauto=yes;; - m) + m|mapped) # shellcheck disable=SC2034 # appears unused opt_mapped=yes;; \?) @@ -593,13 +595,14 @@ # # Global option handling # -while getopts "Vh" _opt ; do +while getopts "Vh-:" _opt ; do + postprocess_getopts_for_long "Vh-:" _opt "version" "help" "" case "${_opt}" in - V) + V|version) printf 'fports %s\n' '@@SIMPLEVERSIONSTR@@' exit 0 ;; - h) + h|help) echo "${USAGE}" exit 0 ;;
