#!/bin/sh
# shellcheck disable=SC2016

set -eu

: git-submodule

#######################################
# repository pull and submodules update
# Arguments:
#   None
#######################################
main() {
  case "${1-}" in
    -h|--help|help)
    printf "%s\n"  "usage: ${0##*/} <path>" "" "repository pull and submodules update"
    exit
    ;;
  esac

  PATH="$(cd "$(dirname "$0}")" || return 1; pwd -P):${PATH}"

  git pull --quiet "$@" &&
  git submodule --quiet sync --recursive &&
  git submodule --quiet update --init --recursive --merge
}

main "$@"
