_sso_mib_tool_completion() {
  local cur prev opts commands
  cur="${COMP_WORDS[COMP_CWORD]}"
  prev="${COMP_WORDS[COMP_CWORD-1]}"
  opts="-a -A -d -h -I -P -s -t"
  commands="getAccounts removeAccount acquirePrtSsoCookie acquireTokenInteractive acquireTokenSilent getLinuxBrokerVersion generateSignedHttpRequest"

  # If it's the first argument and not an option, suggest commands
  if [[ ${COMP_CWORD} -eq 1 ]] && [[ "$cur" != -* ]]; then
    COMPREPLY=($(compgen -W "$commands" -- "$cur"))
    return 0
  fi

  case "$prev" in
    -a)
      COMPREPLY=($(compgen -W "0 1 2 3" -- "$cur"))
      return 0
      ;;
    *)
      ;;
  esac

  if [[ "$cur" == -* ]]; then
    COMPREPLY=($(compgen -W "$opts" -- "$cur"))
  fi
}

complete -F _sso_mib_tool_completion sso-mib-tool
