#!/usr/bin/env bash # SPDX-License-Identifier: AGPL-3.0-or-later STATIC_BUILD_COMMIT="[build] /static" STATIC_BUILT_PATHS=( 'searx/static/themes/simple/css' 'searx/static/themes/simple/js' 'searx/static/themes/simple/src/generated/pygments.less' 'searx/static/themes/simple/img' 'searx/templates/simple/searxng-wordmark.min.svg' 'searx/templates/simple/icons.html' ) static.help(){ cat </dev/null ( set -e # build the themes themes.all # add build files for built_path in "${STATIC_BUILT_PATHS[@]}"; do git add -v "${built_path}" done # check if any file has been added (in case of no changes) if [ -z "$(git diff --name-only --cached)" ]; then build_msg STATIC "no changes applied / nothing to commit" return 0 fi # check for modified files that are not staged if [ -n "$(git diff --name-only)" ]; then die 42 "themes.all has created files that are not in STATIC_BUILT_PATHS" fi git commit -m "${STATIC_BUILD_COMMIT}" ) } static.build.restore() { build_msg STATIC "git-restore of the built files (/static)" git restore --staged "${STATIC_BUILT_PATHS[@]}" git restore --worktree "${STATIC_BUILT_PATHS[@]}" }