Welcome to mirror list, hosted at ThFree Co, Russian Federation.

check-navigation.sh « scripts - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 69f4a9a61a3b7cac3fcead767253ffeae0237168 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env bash

COLOR_RED="\e[31m"
COLOR_GREEN="\e[32m"
COLOR_RESET="\e[39m"

DUPLICATED_NAV_ENTRIES=$(sed -n -E "s/.*[section|category|doc|]_url: '(.*)'/\1/p" content/_data/navigation.yaml | sort | uniq -d)

printf "${COLOR_GREEN}INFO: Checking for identical duplicate global navigation entries...${COLOR_RESET}\n"

if [[ -n $DUPLICATED_NAV_ENTRIES ]]; then
  for DUPLICATED_NAV_ENTRY in $DUPLICATED_NAV_ENTRIES; do
    printf "${COLOR_RED}ERROR (identical duplicate entry):${COLOR_RESET} %s\n" "${DUPLICATED_NAV_ENTRY}"
  done
  exit 1
else
  printf "${COLOR_GREEN}INFO: No identical duplicate entries found!${COLOR_RESET}\n"
  exit 0
fi