Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/check-ports @ 153:59a334dc9b53
Implement a usage message with the "-h" option
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 04 Nov 2019 09:30:05 +0100 |
| parents | 29e708b524e1 |
| children | 9b388927b12b |
comparison
equal
deleted
inserted
replaced
| 152:29e708b524e1 | 153:59a334dc9b53 |
|---|---|
| 13 :ID: @(#)@@PKGORIGIN@@ $HGid$ | 13 :ID: @(#)@@PKGORIGIN@@ $HGid$ |
| 14 | 14 |
| 15 ' | 15 ' |
| 16 | 16 |
| 17 VERSION='@@VERSION@@' | 17 VERSION='@@VERSION@@' |
| 18 | |
| 19 USAGE=' | |
| 20 USAGE: check-ports [options] [args...] | |
| 21 | |
| 22 Options: | |
| 23 | |
| 24 -V Print the program name and version number to stdout and exit | |
| 25 | |
| 26 -h Print this help message to stdout and exit | |
| 27 | |
| 28 -A Print for every package the status of all repositories | |
| 29 | |
| 30 -a Print the data of all repos that have the package | |
| 31 | |
| 32 -n Print the status of given packages in `args` in all details. | |
| 33 No other options are respected. | |
| 34 | |
| 35 -s Print the status of all packages that need some attention | |
| 36 | |
| 37 -v Print the title and repository of every installed package always | |
| 38 | |
| 39 Per Default (without any option) the status of every package is | |
| 40 printed with respect to repositories that have the package and have | |
| 41 differing versions. | |
| 42 ' | |
| 18 | 43 |
| 19 # | 44 # |
| 20 # Configuration directory | 45 # Configuration directory |
| 21 # | 46 # |
| 22 : ${CONFIGDIR:=@@ETCDIR@@} | 47 : ${CONFIGDIR:=@@ETCDIR@@} |
| 401 fi | 426 fi |
| 402 done | 427 done |
| 403 } | 428 } |
| 404 | 429 |
| 405 | 430 |
| 406 check_packages() { | 431 check_given_packages() { |
| 407 : 'Check the status of all given packages in the most detail possible | 432 : 'Check the status of all given packages in the most detail possible |
| 408 | 433 |
| 409 Args: | 434 Args: |
| 410 $@: the name of packaged to handle to | 435 $@: the name of packaged to handle to |
| 411 | 436 |
| 462 option_alldata_LocalRepo="" | 487 option_alldata_LocalRepo="" |
| 463 option_short="" | 488 option_short="" |
| 464 option_verbose="" | 489 option_verbose="" |
| 465 option_packages="" | 490 option_packages="" |
| 466 | 491 |
| 467 while getopts "VAansv" _opt ; do | 492 while getopts "VhAansv" _opt ; do |
| 468 case ${_opt} in | 493 case ${_opt} in |
| 469 V) | 494 V) |
| 470 printf 'check-ports v%s (rv:%s)\n' "${VERSION}" '@@HGREVISION@@' | 495 printf 'check-ports v%s (rv:%s)\n' "${VERSION}" '@@HGREVISION@@' |
| 471 exit 0 | 496 exit 0 |
| 472 ;; | 497 ;; |
| 498 h) | |
| 499 echo "${USAGE}" | |
| 500 exit 0 | |
| 501 ;; | |
| 473 A) | 502 A) |
| 474 # Print for every package the status of all repositories | 503 # Print for every package the status of all repositories |
| 475 option_alldata="1" | 504 option_alldata="1" |
| 476 option_alldata_FreeBSD="1" | 505 option_alldata_FreeBSD="1" |
| 477 option_alldata_LocalBSDPorts="1" | 506 option_alldata_LocalBSDPorts="1" |
| 523 echo "the -s option cannot be combined with -A or -a" >&2 | 552 echo "the -s option cannot be combined with -A or -a" >&2 |
| 524 exit 2 | 553 exit 2 |
| 525 fi | 554 fi |
| 526 | 555 |
| 527 if [ -n "${option_packages}" ]; then | 556 if [ -n "${option_packages}" ]; then |
| 528 check_packages "$@" | 557 check_given_packages "$@" |
| 529 else | 558 else |
| 530 check_ports | 559 check_ports |
| 531 fi | 560 fi |
