get_opts

    0

    7

    opts

    The code is looping though the ":ls" options, and setting the value of the "TAG_TYPE" variable according to the option given.

    Shortcut: get_opts

    while getopts ":ls" options; do
      case ${options} in
      l)
        TAG_TYPE="long"
        ;;
      s)
        TAG_TYPE="short"
        ;;
      :)
        echo "ERROR: Invalid option: ${OPTARG} requires an argument" 1>&2
        exit 1
        ;;
      \?)
        echo "ERROR: Invalid option: ${OPTARG}" 1>&2
        exit 1
        ;;
      esac
    done
    shift $((OPTIND - 1))
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.