Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command options for help and version. #36

Closed
virgilwashere opened this issue May 22, 2019 · 0 comments · Fixed by #53
Closed

Add command options for help and version. #36

virgilwashere opened this issue May 22, 2019 · 0 comments · Fixed by #53
Labels
features good first issue Easy enough to contribute without much context help wanted

Comments

@virgilwashere
Copy link
Contributor

Add -h and -V options

Basic getopts version:

  #-----------------------------------------------------------------------
  #  Handle command line arguments
  #-----------------------------------------------------------------------
  while getopts ":hV" opt
  do
    # shellcheck disable=SC2214
    case "${opt}" in

      h|help      ) _usage;    exit 0 ;;
      V|version   ) _version;  exit 0 ;;

      \?  ) printf '\nInvalid option: %s\n\n' "${OPTARG}"
            _usage;    exit 2 ;;

    esac    # --- end of case ---
  done
  shift $(( OPTIND-1 ))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features good first issue Easy enough to contribute without much context help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants