Skip to content

Conversation

@Ndacyayisenga-droid
Copy link

@Ndacyayisenga-droid Ndacyayisenga-droid marked this pull request as draft August 29, 2023 07:14
@Ndacyayisenga-droid Ndacyayisenga-droid marked this pull request as ready for review August 29, 2023 09:58
@Ndacyayisenga-droid Ndacyayisenga-droid marked this pull request as draft August 29, 2023 15:54
DEBDISTS=("bookworm" "bullseye" "buster" "kinetic" "jammy" "focal" "bionic")
RPMDISTS=("centos/7" "rocky/8" "rhel/7" "opensuse/15.3")

if [ $# -eq 0 ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a script should have a documentation that is printed to the Command-line. The documentation should contain the functionality of the script and possible parameters with documentation.

Example

usage="$(basename "$0") [-h] [-s n] -- program to calculate the answer to life, the universe and everything

where:
    -h  show this help text
    -s  set the seed value (default: 42)"

seed=42
while getopts ':hs:' option; do
  case "$option" in
    h) echo "$usage"
       exit
       ;;
    s) seed=$OPTARG
       ;;
    :) printf "missing argument for -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
   \?) printf "illegal option: -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
  esac
done
shift $((OPTIND - 1))

Copied from https://stackoverflow.com/questions/5474732/how-can-i-add-a-help-method-to-a-shell-script

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such a script should have a documentation that is printed to the Command-line. The documentation should contain the functionality of the script and possible parameters with documentation.

Example

usage="$(basename "$0") [-h] [-s n] -- program to calculate the answer to life, the universe and everything

where:
    -h  show this help text
    -s  set the seed value (default: 42)"

seed=42
while getopts ':hs:' option; do
  case "$option" in
    h) echo "$usage"
       exit
       ;;
    s) seed=$OPTARG
       ;;
    :) printf "missing argument for -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
   \?) printf "illegal option: -%s\n" "$OPTARG" >&2
       echo "$usage" >&2
       exit 1
       ;;
  esac
done
shift $((OPTIND - 1))

Copied from https://stackoverflow.com/questions/5474732/how-can-i-add-a-help-method-to-a-shell-script

Thannks for the pointer @hendrikebbers. Actually there is still more work to this script. I think we can consider this as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants